Question: Algorithm analysis 12. Consider the following algorithm which does nothing but waste time: WasteTime(n (pre: n21) I. if n>1 2, for i l to n'
12. Consider the following algorithm which does nothing but waste time: WasteTime(n (pre: n21) I. if n>1 2, for i l to n' 3. 4, for 14-1to 7 5. waste 2 units of time . Waste Time(n/21) WasteTimen2) waste 3 units of time a. Write a recurrence formula which gives the amount of time T(n) wasted by this algorithm. b. Show that when n is an exact power of 2, the solution to this recurrence relation is given by 31 T(n) = 16n,-2-2n, and hence T(n)-6(", )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
