Here is the draft of the recursive function that finds out whether the positive number is a power of 2. For example, 64 is a power of 2, but 12 is not.
Is X a power of 2:
- If X = 1, the result is YES
- If X > 1 and X < 2, the result is NO
- If X >= 2, see: "Is X / 2 (floating point division) a power of 2"
How many times will we make the reduction step (i.e. will the function call itself) for X = 10?