Question: 1. (10%) The following code D2B is designed to print the binary representation of a nonnegative decimal number N. (a) (4%) Please complete the code

1. (10%) The following code D2B is designed to print the binary representation of a nonnegative decimal number N. (a) (4%) Please complete the code using recursion. (b) (3%) Suppose the program is correctly implemented. What will be printed when D2B(N) is called with N=37? (c) (3%) What is the time complexity of D2B(N)? Express your answer in the big-O notation. void D2B(int N) { if (N == 0 or N == 1) { print (N) } else (To be completed) }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
