SupposewehaveT(n)≤c=O(1)foralln≤3,andforeveryn≥4,wehave ,T(n)<=T(n/4)+T(0.75n*)+cn,Use Mathematical Induction to prove that T (n) = O(n log n) for all n ≥ 4.
时间: 2023-03-13 09:12:10 浏览: 137
用数学归纳法证明T(n)=O(nlogn),可将n分为三种情况。首先,当n=4时,T(n)≤T(1)=c=O(1),由假设可知T(n)<=T(n/4) T(0.75n*) cn,故T(4)≤T(1) T(3) T(3) c4,即T(4)≤c4,即T(4)=O(4),证明了当n=4时T(n)=O(n)。其次,假设当n=k时T(k)=O(k)成立,即T(k)≤ck,则当n=k+1时T(k+1)≤T(k/4)T(3k/4)T(3k/4)ck+1,即T(k+1)≤ck+1,即T(k+1)=O(k+1),证明了当n=k+1时T(n)=O(n)。最后,由数学归纳法可知,当n≥4时,T(n)=O(nlogn)。
相关问题
SupposewehaveT(n)≤c=O(1)foralln≤3,andforeveryn≥4,wehave ,T(n)<=T(n/4)+T(0.75*n)+cn,Use Mathematical Induction to prove that T (n) = O(n log n) for all n ≥ 4.
令P(n)表示T(n)<=cn,n>=4。令k>=4,由数学归纳法,我们可以证明P(k)为真,即T(k)<=ck。证明P(k+1):由T(n)<=T(n/4)T(0.75*n) cn,有T(k+1)<=T(k/4)T(0.75*(k+1)) c(k+1)由P(k),有T(k)<=ck因此,T(k+1)<=ckT(0.75*(k+1)) c(k+1)<=ck c(k+1)即P(k+1)为真。因此,使用数学归纳法可以证明T (n) = O(n log n) , n>=4.
SupposewehaveT(n)≤c=O(1)foralln≤3,andforeveryn≥4,wehave ,T(n)<=T(n/4)+T(3*n/4)+c*n,Use Mathematical Induction to prove that T (n) = O(n log n) for all n ≥ 4.
证明过程应该是这样的:首先,假设T (k) = O(k log k) 成立,其中 k ≥ 4。接着,T (k+1) = T (3/4(k+1)) ≤ c*3/4(k+1) = c*k + c*3/4 ≤ c*k + c ≤ c*(k+1) = O (k+1)。由于T (k) = O(k log k),所以有T (k+1) = O (k+1 log (k+1))。因此,T (n) = O(n log n) 也成立。
阅读全文