I was hoping to get some clarification on something...
I'm learning about recurrence relations, and one that I'm trying to do as an example is mergesort. I've done the recurrence relation several times and the result I keep getting is O(N), even though the textbook says it's O(Log(N)).
Mergesort has the recurrence :
T(1) = 1 T(N) = 2 * T(N/2) + c
After a few iterations I get...
2^k * T(N/2^k) + C*sum(i = 0 -> k-1)2^i
When I solve for k, I get log2(N), so I can simplify in the following way:
(2^log2(N)) * T(N/2^log2(n)) + C*sum(i = 0 -> k - log2(n)-1)2^i =
N * T(N/N) + C(N-1) = N * d + CN + N
Which boils down to O(N)
HOWEVER
According to my textbook, Mergesort should be O(log(N)).
Is there something wrong with my calculations?
I also found someone did the same relation here and got the exact same result : http://courses.cs.washington.edu/courses/cse326/06su/lectures/lecture13_proofs.pdf
Any guidance would be appreciated!