void qsort1(double* first, double* last)
Sorts the elements of [first, last) into ascending numerical order using the merge sort.
void qsort2(double* first, double* last, double* first2)
Sorts the elements of [first, last) into ascending numerical order using the merge sort while making the same rearrangement of the elements of [first2, first2 + (last - first) ).
void qsort2key(double* first, double* last, double* first2)
Sorts the element of [first, last) and [first2, first2 + (last - first) ) into ascending order using [first1, last1) as the primary key and [first2, first2 + (last - first) ) as the secondary key.
Parameters:
first | Beginning iterator for element container. |
---|---|
last | Ending iterator for element container |
first2 | Beginning iterator for second element container. |
Returns:
The values in [first, last) are sorted inplace and the first2 elements are changed accordingly.
Usage:
double x[] = {2.0, 3.0, 2.5, 1.4, 5.3}; double y[] = {1.0, 2.0, 3.0, 2.5, 3.6}; qsort2(x, x + 5, y);
Header:
#include "sort.h"