JANITORIAL: Some small explanation about stability of sorting algorithms.
Special thanks to lskovlun for his suggestion to add this. svn-id: r51524
This commit is contained in:
parent
fd0f5696a5
commit
f75d84cbdd
1 changed files with 13 additions and 2 deletions
|
@ -199,8 +199,19 @@ T sortPartition(T first, T last, T pivot, StrictWeakOrdering &comp) {
|
||||||
* It compares data with the given comparator object comp.
|
* It compares data with the given comparator object comp.
|
||||||
*
|
*
|
||||||
* Like std::sort this is not guaranteed to be stable.
|
* Like std::sort this is not guaranteed to be stable.
|
||||||
* Actually as the time of writing our implementation
|
*
|
||||||
* is unstable.
|
* Two small quotes from wikipedia about stability:
|
||||||
|
*
|
||||||
|
* Stable sorting algorithms maintain the relative order of records with
|
||||||
|
* equal keys.
|
||||||
|
*
|
||||||
|
* Unstable sorting algorithms may change the relative order of records with
|
||||||
|
* equal keys, but stable sorting algorithms never do so.
|
||||||
|
*
|
||||||
|
* For more information on that topic check out:
|
||||||
|
* http://en.wikipedia.org/wiki/Sorting_algorithm#Stability
|
||||||
|
*
|
||||||
|
* NOTE: Actually as the time of writing our implementation is unstable.
|
||||||
*/
|
*/
|
||||||
template<typename T, class StrictWeakOrdering>
|
template<typename T, class StrictWeakOrdering>
|
||||||
void sort(T first, T last, StrictWeakOrdering comp) {
|
void sort(T first, T last, StrictWeakOrdering comp) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue