I have been asked to analyze the asymptotic time complexity of the following recursion function:
for-all k ≥ 1:
T(n) = n + T(n/2) + T(n/4) + T(n/8) + .... + T(n/2^k)
I was able to prove that:
T(n) = O(n⋅log n)
and T(n) = Ω(n)
,
but I am looking for a tighter bound (Big Theta).
First of all:
I understand "for-all k >= 1" this way: for
k = 1
tok = m
where2m-1 ≤ n ≤ 2m
.So basicly
m = log₂(n)
holds.Have a look at my calculation:
So
T(n)
is inΘ(n)
.Notice:
You can also approximate
Σk=1,...,m k/2k
by the integrals(m) = ∫1m k/2k dk
.And here
limm → ∞s(m) = 2
also holds.