An exploration of the recurrence relation T(n) = 2T(n/2) + n, demonstrating how to use substitution and normalization to find a closed form and asymptotic complexity.
(a) Transformation
Substitute n = 2^k to rewrite the recurrence in terms of the exponent k.
(b) Normalization
Divide the entire recurrence by 2^k to reduce it to a simple additive form S(k) = S(k-1) + 1.
(c) Solving
Use the initial condition S(0) = T(1)/1 = 1 to solve the arithmetic recurrence S(k) = k + 1.
(d) Back-Substitution
Substitute S(k) = T(n)/n and k = log2(n) to obtain the final closed-form expression.
(e) Asymptotics
Identify the dominant term as n log n, leading to the asymptotic class.
Original question
Solve the recurrence relation T(n) = 2 T(n/2) + n for n a power of 2, with T(1) = 1. Find a closed form for T(n) and state the asymptotic complexity.
Ask me anything about this lesson — I'll answer using what we just covered.