partial_sort

Syntax:

    #include <algorithm>
    void partial_sort( random_access_iterator start, random_access_iterator middle, random_access_iterator end );
    void partial_sort( random_access_iterator start, random_access_iterator middle, random_access_iterator end, StrictWeakOrdering cmp );

The partial_sort() function arranges the first N elements of the range [start,end) in ascending order. N is defined as the number of elements between start and middle.

By default, the < operator is used to compare two elements. If the strict weak ordering comparison function cmp is given, it is used instead.

Related Topics: binary_search, is_sorted, nth_element, partial_sort_copy, sort, stable_sort