Ad2d
- 9
- 0
Homework Statement
f(n) = 0 when n=1 and 2f(n/2) + n - 1 when n is otherwiseHomework Equations
Repeated substitution
The Attempt at a Solution
f(n) = 2f(n/2) + n - 1
= 22f(n/22) + n - 3
= 23f(n/23) + n - 7
= 24f(n/24) + n - 15
Guess: f(n) = 2kf(n/2k) + n - (k-1)
we know from the recurrence that f(1) = 0, so need n/2k = 0
so n/2k => n = 2k => lg n = k where lg is not log based 10 but log based 2
f(n) = 2lg nf(n/2lg n) + n - lg n + 1
when n = 1
f(n) = 2lg 1f(n/2lg 1) + 1 - lg 1 + 1 = 1f(1) + 1 + 0 + 1 = 2 so this recurrence cannot be proven,
Last edited: