Q. Look at compute numbers one more time:

 

compute(1) = 1

compute (N) = compute(N-1) + 2N-1

 

Assume the definition has been implemented correctly. How many invocations will there be on the call stack is _main_ is compute (5)?

 

(A) 1

(B) 3

(C) 5

(D) 6

 

Answer =

Option (c) is correct.

 

 

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post