SupposewehaveT(n)≤c=O(1)foralln≤3,andforeveryn≥4,wehave ,T(n)<=T(n/4)+T(0.75*n) + c*n,Use Mathematical Induction to prove that T (n) = O(n log n) for all n ≥ 4.
时间: 2023-03-13 13:12:10 浏览: 95
C的四则运算
证明:首先,假设T(n)<=c*n,当n=4时,我们有T(4)<=c*4,即T(4)<=O(1);假设T(k)<=c*k*log k,当k>4时,由T(n)<=T(n/4) T(0.75*n)和T(n)<=c*n可得:T(n)<=(c/4)*n*log(n/4)+(3/4)*c*n<=c*n*(log n-log 4+3)<=c*n*log n,即T(n)<=c*n*log n,由归纳法可知T(n)<=c*n*log n 对于所有n >= 4。因此,T(n)=O(n log n) 对于所有n>=4。
阅读全文