Question: File EditView Go Tools Window Help @? 89% us. Thu Sep 27 4:45:24 PM CMP340 Homework1-2 pdt (page 2 of 2) O. Q Search Q4)
File EditView Go Tools Window Help @? 89% us. Thu Sep 27 4:45:24 PM CMP340 Homework1-2 pdt (page 2 of 2) O. Q Search Q4) [5 points] Consider the following two algorithms: ALGORITHM1 BinRec(n) //Input: A positive decimal integer n s in n's binary representation ifn 1 return 1 else return Bin Rec(Ln/2) +1 ALGORITHM 2 Binary(n) //Input: A positive decimal integer /Output: The number of binary digits in n's binary representation count 1 while n > 1 do count count + 1 n |n/2] return count a. Analyze the two algorithms and find the efficiency for each of them. Hint: You may use the recurrence relation instead of the summation to analyze the nonrecursive algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
