Question: Consider the following recursive algorithm, where b and n are nonnegative integers. ALGORITHM mighty (b, n) { if (n == 0) return b else return

Consider the following recursive algorithm, where b and n are nonnegative integers. ALGORITHM mighty (b, n) { if (n == 0) return b else return b*b*mighty (b, n-1) } (i) What does this algorithm compute? (ii) Based on the key operation of the algorithm, set up a recursive relation for the time complexity analysis of the algorithm. Use the approach of backward substitutions to solve for the suggested recursive relation. (iii) Identify two drawbacks of the algorithm mighty(b, n) and suggest methods to improve its performance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
