《算法导论》第四章-第6节_练习(参考答案)

来源:互联网 发布:java jar 临时指定jdk 编辑:程序博客网 时间:2024/05/21 10:41

算法导论(第三版)参考答案:练习4.6-1,练习4.6-2,练习4.6-3

Exercise 4.6-1

⋆ Give a simple and exact expression for nj in equation (4.27) for the case in which b is a positive integer instead of an arbitrary real number.

nj=n/bj 。( 一个很好的证明 )

Exercise 4.6-2

⋆ Show that if f(n)=Θ(nlogbalgkn), where k0, then the master recurrence has solution T(n)=Θ(nlogbalgk+1n). For simplicity, confine your analysis to exact powers of b.

g(n)=j=0logbn1ajf(n/bj)

f(n/bj)=Θ((n/bj)logbalgk(n/bj)) 代入 g(n)
g(n)=Θ(j=0logbn1aj(nbj)logbalgk(nbj))j=0logbn1aj(nbj)logbalgk(nbj)=nlogbaj=0logbn1(ablogba)jlgknbj=nlogbaj=0logbn1lgknbjj=0logbn1lgknbj=j=0logbn1(lgkno(lgkn))=logbnlgkn+logbno(lgkn)=Θ(logbnlgkn)=Θ(lgk+1n)g(n)=Θ(nlogbalgk+1n)

所以

T(n)=Θ(nlogba)+g(n)=Θ(nlogba)+Θ(nlogbalgk+1n)=Θ(nlogbalgk+1n)

Exercise 4.6-3

⋆ Show that case 3 of the master method is overstated, in the sense that the regularity condition af(n/b)cf(n) for some constant c<1 implies that there exists a constant ϵ>0 such that f(n)=Ω(nlogba+ϵ).

α=a/c

af(n/b)cf(n)αf(n/b)f(n)αf(n)f(nb)αif(n)f(nbi)αif(1)f(bi)

n=bi,i=logbn,所以

f(n)αlogbnf(1)=Ω(nlogbα)α>aα=a+d(c<1,d>0)f(n)=nlogba+logbd=nlogba+ϵ(ϵ=logbd)

解答参考。

阅读全文
0 0