Answered step by step
Verified Expert Solution
Question
1 Approved Answer
answer it correctly for questions 4 & 5 using C program . take your time Design an efficient algorithm that achieves the following t ask:
answer it correctly for questions 4 & 5 using C program . take your time
Design an efficient algorithm that achieves the following t ask: Given an array A[1.n] of floating point numbers, it returns a two-dimensional array, say M, of size nn in which the entry M[i][j] for ij contains the average of the array entries A[i] through A[j]. That is: if ij, then M[i][j]=ji+1A[i]++A[j] whereas for i>j we have that M[i][j]=0. 1. Describe your idea for an algorithm that creates this matrix. 2. Write down the algorithm in pseudocode. 3. How many assignments will your algorithm perform for an input of size n ? 4. Implement the algorithm in the ArrayofAverages class. 5. Write code to measure the running time of your Java or C program for random inputs of size n=10,100,1000, etc. Does the growth of the running time correspond to your estimate of the number of assignmentsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started