Skip to main content

New answers tagged

0 votes

Diffucuty in understanding code after a recursive call

You use complete induction and prove two things: 1. The function is correct for the starting case (often i = 0 or i = 1). 2. If the function is correct for all cases with i < I, then it is also ...
gnasher729's user avatar
1 vote
Accepted

What is the complexity of this tree recursive integer replacement algorithm?

I figured out the answer to my question. The time complexity is $O(\log(n))$ because $n$ is halved every two calls (worst case). For more detail, see my solution.
Ellen Spertus's user avatar

Top 50 recent answers are included