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.
时间: 2023-03-13 08:48:28 浏览: 104
C的四则运算
证明过程应该是这样的:首先,假设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) 也成立。
阅读全文