Sort (C++) - Other Types of Sorting

Other Types of Sorting

sort is not stable: equivalent elements that are ordered one way before sorting may be ordered differently after sorting. stable_sort ensures stability of result at expense of worse performance (in some cases). Result of partial_sort is N sorted elements from M, the rest (M - N) is left in undefined order. Depending on design this may be faster than complete sort.

Some containers, among them list, provide specialised version of sort as a member function. This is because linked lists don't have random access (and therefore can't use the regular sort function); and the specialised version also preserves the values list iterators point to.

Read more about this topic:  Sort (C++)

Famous quotes containing the word types:

    The American man is a very simple and cheap mechanism. The American woman I find a complicated and expensive one. Contrasts of feminine types are possible. I am not absolutely sure that there is more than one American man.
    Henry Brooks Adams (1838–1918)