| [reply] |

perldoc -f sort | grep algo
Perl 5.6 and earlier used a quicksort algorithm to implement
sort. That algorithm was not stable, and *could* go quadratic.
implementation was replaced with a stable mergesort algorithm
sort. Its rather blunt control of the underlying algorithm may
# guarantee stability, regardless of algorithm
| [reply] |

And now including the lines that do not contain the word "algorithm":
Perl 5.6 and earlier used a quicksort algorithm to implement
sort. That algorithm was not stable, and could go quadratic.
(A stable sort preserves the input order of elements that
compare equal. Although quicksorts run time is O(NlogN) when
averaged over all arrays of length N, the time can be O(N**2),
quadratic behavior, for some inputs.) In 5.7, the quicksort
implementation was replaced with a stable mergesort algorithm
whose worst-case behavior is O(NlogN). But benchmarks
indicated that for some inputs, on some platforms, the original
quicksort was faster. 5.8 has a sort pragma for limited
control of the sort. Its rather blunt control of the
underlying algorithm may not persist into future Perls, but the
ability to characterize the input or output in implementation
independent ways quite probably will. See sort.
| [reply] |

`perldoc -f sort | grep -C5 algo
`
:) | [reply] [d/l] |

| [reply] [d/l] |

| [reply] [d/l] |

Comment onsorting agorithm