I am refreshing on Master Theorem a bit and I am trying to figure out the running time of an algorithm that solves a problem of size n
by recursively solving 2 subp
May be you could think of it this way
when
n = 1, T(1) = 1
n = 2, T(2) = 2
n = 3, T(3) = 4
n = 4, T(4) = 8
n = 5, T(5) = 16
It is easy to see that this is a geometric series 1 + 2+ 4+ 8 + 16...
, the sum of which is
first term (ratio^n - 1)/(ratio - 1)
. For this series it is
1 * (2^n - 1)/(2 - 1) = 2^n - 1.
The dominating term here is 2^n
, therefore the function belongs to Theta(2^n)
. You could verify it by doing a lim(n->inf) [2^n / (2^n - 1)] = +ve constant.
Therefore the function belongs to Big Theta (2^n)