Algorithm prefix Avg 1(X): input: An n-element array X ted to the above problem. Answer the questions given below. output: An n-element array A of numbers such that A[i] is the average of elements X[0], X[i] 1 Declare and initialize array A 2 for i = 0 to n-1 do 3 a = 0 4 for j = 0 to i do 5 a tz X[j] 6 A[i] = a / (i+1) 7 return array A Algorithm prefix Avg2(x): input: An n-element array X output: An n-element array A of numbers such that A[i] is the average of elements X[0], X[i] 1 Declare and initialize array A 2 a = 0 3 for i = to n-1 do 4 a + x[i] 5 A[i] = a / (i+1) 6 return array A a. Determine the worst runtime complexity of both the algorithms. b. Comment which algorithm is better than the other?
Answers
Answered by
0
Answer:
gghhhhuuuuiiiiiiii gghhhhuuuuiiiiiiii� gghhhhuuuuiiiiiiii�ऐसा uuhgggggggvgg gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk gjnnvvnnbvbnjkk
Similar questions
CBSE BOARD X,
4 months ago
Math,
4 months ago
English,
8 months ago
Sociology,
11 months ago
Chemistry,
11 months ago