Translations of this page?:

stable_sort

Syntax:

    #include <algorithm>
    void stable_sort( random_access_iterator start, random_access_iterator end );
    void stable_sort( random_access_iterator start, random_access_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 each other.

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: binary_search, is_sorted, partial_sort, partial_sort_copy, sort

 
• • • IndexRecent changesRSScc