METYCSSA (#5): Mergesort
Mergesort algorithm
- split list in half, sort first half, sort second half, merge together
T(n) <= 2T(n/2) + cn if n > 1
<= 2(2T(n/4) + c(n/2)) + cn
<= 4(2T(n/8) + c(n/4)) + cn + cn
<= 2kT(n/2k) + kcn (extrapolating 1 < k ? n)
<= nT(1) + cn log n (for 2k = n or k = log n)