Explanation : PP(3, 4) = _____
PP function:
Len = tob(b, arr)
tob functions:
i = 0 4 > 0, (with b = 4)
if (4 % 2) False, so else gets executed
So, arr[0] = 0,
if t b = b/2
i = 1 2 > 0 (with b = 2)
if (2 % 2) false
So, else gets executed ⇒ arr [1] = 0, i = i + t b = b/2
i = 2 1 > 0 (with b = 1)
if (1 % 2) True arr [2] = 1 i + 1, b = b/2
i = 30 > 0 (with b = 0) false
return I, returns ‘3’ to len, in PP function.
In PP function: len = 3
For loop.