Question: Do quick Let x be an integer greater than or equal to 0. We let the symbol compositefunction be concatenation, 1 compositefunction 1 = 11
Let x be an integer greater than or equal to 0. We let the symbol compositefunction be concatenation, 1 compositefunction 1 = 11 as strings for example. Note, every integer x greaterthanorequalto 0 can be written as x = b_k 2^k + b_k-1 2^k-1 +.... + b_12^1 + b_0 2^0 where b_i elementof {0, 1}. We say x's binary expression is the string b_k b_k-1 compositefunction b_1 b_0 procedure bitDecomp(x) if(x = 0) then return 0: if(x is odd) then return bitDecomp((x - 1)/2) compositefunction 1: if(x is even) then return bitDecomp(x/2) compositefunction 0: a) Consider the problem instance x = 101. What does the algorithm return? Explain with your own words the purpose of the algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
