stable_sort
Syntax:
#include <algorithm> void stable_sort( iterator start, iterator end ); void stable_sort( iterator start, iterator end, StrictWeakOrdering cmp );
The stable_sort() algorithm is like the sort() algorithm, in that it sorts a range of elements into ascending order. Unlike sort(), however, stable_sort() will preserve the original ordering of elements that are equal to eachother.
This functionality comes at a small cost, however, as stable_sort() takes a few more comparisons that sort() in the worst case: N (log N)^2 instead of N log N.
Related topics: