Minus One Not Half

Someone applies the master theorem to T(n)=T(n−1)+T(n−2)+1T(n) = T(n-1) + T(n-2) + 1, reads off a=2a = 2 and b=1b = 1, and concludes Θ(n)\Theta(n). What went wrong, and what is the real answer?

A

The tree has depth nn and each level costs O(1)O(1), so Θ(n)\Theta(n) is right by accident.

B

The theorem covers T(n)=aT(n/b)+f(n)T(n) = aT(n/b) + f(n), where subproblems shrink by a constant factor. These shrink by a constant amount, so no bb exists and b=1b = 1 is meaningless. The solution is Θ(φn)\Theta(\varphi^n) with φ=(1+5)/2\varphi = (1+\sqrt5)/2.

C

The setup is fine but the wrong case was chosen; case 2 gives Θ(nlog⁡n)\Theta(n \log n).

D

Θ(2n)\Theta(2^n). Every call makes two more, so the tree is a complete binary tree of depth nn.