Question: Time analysis of algorithm consisting of while loop in a for loop. As many explanations as possible for each line please and show all caluclations.
Time analysis of algorithm consisting of while loop in a for loop. As many explanations as possible for each line please and show all caluclations.
A={3,4,2,1,5,6}startindex=1n=6 1: for i=1 to n 2: sum =0 3: j=1 4: while (jn) 5: sum =sum+A[j] 6: j++ 7: pritt sum Find t(n) ? Show unsimplified and notation. Calculations + explanations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
