Question: 3. (3 marks) Consider the following pseudocode program: program (int n) if n = 1 return 0 else return 1+program (floor (n/2)) (a) Run

3. (3 marks) Consider the following pseudocode program: program (int n) if n = 1 return 0 else return 1+program (floor (n/2)) (a) "Run" 4 the program on some inputs, to get a feel for how it operates. Eg: n = 32, -1. (b) Prove that on input n N+ the output is [log2 n]. 5 (c) On input n N+, (roughly 6) how many times is the line starting with return 1 + program(... executed?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
