Question: Question 5: Consider the following recursive algorithm MYSTERY(a,b), which takes as input two integers a and b with a > 1 and 6 20: Algorithm

 Question 5: Consider the following recursive algorithm MYSTERY(a,b), which takes as

Question 5: Consider the following recursive algorithm MYSTERY(a,b), which takes as input two integers a and b with a > 1 and 6 20: Algorithm MYSTERY(a,b): if b=0 then c=1 else if b is even then c= MYSTERY(a,6/2) else c = a MYSTERY(a, b - 1) endif endif; return e (5.1) Explain why, for any two integers a > 1 and b > 0, algorithm MYSTERY(a, b) termi- nates. (5.2) Let a 2 1 and 6 2 0 be two integers. What is the output of algorithm MYSTERY(a,b)? Justify your answer (5.3) Let a > 1 and 6 > 2 be two integers. Prove that the recursion depth of algorithm MYSTERY(a,b) is O(logb). (5.4) Let a > 2 and 6 > 2 be two integers, and let n be the output of algorithm MYSTERY(a,b). Prove that the recursion depth of algorithm MYSTERY(a, b) is (log logn)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!