合并排序时间复杂度推导
算法演示
算法演示1
算法演示2
算法复杂度
Big O notation is a mathematical notation that describes the limiting behavior of a function
when the argument tends towards a particular value or infinity.
算法复杂度推导
显然
f ( 1 ) = 1 f(1) = 1 f(1)=1
对于f(n),它的复杂度相当于合并两个数量为n/2的排好序的子序列, 合并的工作量为n. 于是:
f ( n ) = 2 f ( n 2 ) + n f(n) = 2f(\frac{n}{2}) + n f(n)=2f(2n