Unformatted text preview: 3. (25 points) Use substitution/induction to prove the correctness of your answer to Problem (2) above. Be sure to justify both the O and parts of the statement. 4. (30 points) Consider the pseudocode below: ) ( n Mystery 1 // Input: n = 4 k for some positive integer k 2 if 1 n 3 return 4 for i = 1 to n 5 for j = 1 to n 6 for k = 1 to n 7 print Values of i , j , k = , i , j , k 8 ) 4 / ( n Mystery The goal of this problem is to find tight upper and lower bounds on the best, average and worst-case running time of ) ( n Mystery as a function of the input n . a) (15 points) Formulate a recurrence for the running time of ) ( n Mystery as a function of the input n . Explain why this recurrence describes the best, average and worst-case running time of ) ( n Mystery . b) (15 points) Find a closed form solution to your recurrence from part (a) above....
View Full Document
- Fall '09
- Algorithms, Analysis of algorithms, Computational complexity theory, web site, 4k, 49k, recurrence