H(n) | = | n(log2n + 1) |
= | nlog2n + n |
Since n ≤ nlog2n, then
H(n) | ≤ | nlog2n + nlog2n |
≤ | 2nlog2n |
But H(n) ≥ nlog2n, so
nlog2n | ≤ | H(n) | ≤ | 2nlog2n |
Thus the time it takes to merge sort n cards is:
This can also be expressed without a logarithmic base as:
since a number's logarithms of different bases differ only by a constant factor (logca = logba × logcb).