Chapter 21 Recurrences884
Looks likepD 1 does the job. Then we compute the integral:
T.n/D‚n1 C
Zn1u 1
u^2duD‚
n1 C
loguC1
un1D‚
nlognC1
nD‚.nlogn/:The first step is integration and the second is simplification. We can drop the1=n
term in the last step, because the lognterm dominates. We’re done!
Let’s try a scary-looking recurrence:
T.n/D2T.n=2/C.8=9/T.3n=4/Cn^2 :Here,a 1 D 2 ,b 1 D1=2,a 2 D8=9, andb 2 D3=4. So we find the valuepthat
satisfies
2 .1=2/pC.8=9/.3=4/pD1:
Equations of this form don’t always have closed-form solutions, so you may need
to approximatepnumerically sometimes. But in this case the solution is simple:
pD 2. Then we integrate:
T.n/D‚n^21 C
Zn1u^2
u^3du