This is the recursion method:
where the method is called for k = 16
The output is 4 but I don't see how. I'm having a hard time understanding recursion. Anyone explain how this works?
public int mystery (int k) { if (k == 1) return 0; else return (1 + mystery(k/2)); }
where the method is called for k = 16
The output is 4 but I don't see how. I'm having a hard time understanding recursion. Anyone explain how this works?