Question PSC-FUNC-0065
HardWhat will be the output of the following pseudocode?
Integer depth = 0, maxDepth = 0
Function r(Integer n)
depth = depth + 1
if (depth > maxDepth) maxDepth = depth end if
if (n > 1)
r(n / 2)
r(n / 2)
end if
depth = depth - 1
End Function
r(16)
Print maxDepth
- A.
16
- B.
31
- C.
Sign up free to see the answer and a step-by-step explanation.