Question: 24. Consider the following classical recursive algorithm for computing the factorial n! of a non-negative integer n: FACTORIAL(n): if n=0 else return 1 return
24. Consider the following classical recursive algorithm for computing the factorial n! of a non-negative integer n: FACTORIAL(n): if n=0 else return 1 return n FACTORIAL (n - 1) (a) How many multiplications does this algorithm perform? (b) How many bits are required to write n! in binary? Express your answer in the form (f(n)), for some familiar function f(n). [Hint: (n/2)/2 < n!
Step by Step Solution
3.56 Rating (146 Votes )
There are 3 Steps involved in it
a The algorithm performs n multiplications b To write n in binary we ... View full answer
Get step-by-step solutions from verified subject matter experts
