• Complexity:
– For sort(): n-log-n on average (approximately numElems*log(numElems) comparisons
on average).
– For stable_sort(): n-log-n if there is enough extra memory (numElems*log(numElems)
comparisons); otherwise, n-log-n*log-n (numElems*log(numElems)2 comparisons).
The following example demonstrates the use of sort():