P-4.1) Implement pre?x Averages1 and pre?x Averages2 from Section 4.2.5, and per
ID: 3649226 • Letter: P
Question
P-4.1) Implement pre?x Averages1 and pre?x Averages2 from Section 4.2.5, and perform an experimental analysis of their running times. Visualize their running times as a function of the input size with a log-log chart. SECTION 4.2.5: Algorithm: pre?xAverages1 ( X ): Input: An n-element array X of numbers. Output: An n-element array A of numbers such that A[i] is the average of elements X [0],..., X [i]. Let A be an array of n numbers. for i?0 to n?1 do a?0 for j?0 to i do a?a+ X [ j] A[i]?a/(i+1) return array A Algorithm pre?xAverages2( X ): Input: An n-element array X of numbers. Output: An n-element array A of numbers such that A[i] is the average of elements X [0],..., X [i]. Let A be an array of n numbers. s?0 for i?0 to n?1 do s?s+ X [i] A[i]?s/(i+1) return array AExplanation / Answer
is included in the section entitled ”GNU Free Documentation License”. The Time-Frequency Toolbox has been mainly developed under the aus- pices of the French ... O. Michel and P. Abry for their help at different phases of the development. .... looking at a chapter of this tutorial,.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.