• sort(), based historically on quicksort. Thus, this algorithm guarantees a good runtime (n∗ log(n) complexity) on average but may have a very bad runtime (quadratic complexity) in the worst case: // sort all elements // - best n*log(n) complexity on average // - n*n complexity in worst case sort (coll.begin(), coll.end()); If avoiding the worst-case behavior is important, you should use another algorithm, such as partial_sort() or stable_sort().