Published on 2026-09-15
The quicksort trap on an already sorted list
Quicksort is a very efficient sorting algorithm on average that can nevertheless prove disastrous. This failure occurs when the first element is chosen as the pivot and it is applied to a list of values already sorted. It is therefore advisable to avoid this usage or to choose the pivot randomly so that the program functions correctly.
AlgorithmiqueQuelques indications sur l’efficacité des algorithmes et ses biais
Written by AI from Wikipedia — CC BY-SA 4.0