Jump to content

Portal:Mathematics/Selected picture/20

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Dcljr (talk | contribs) at 21:00, 6 October 2015 (starting... (including direct quotes from current Quicksort lead section)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Animation of dots of varying height being sorted by height using the quicksort algorithm
Animation of dots of varying height being sorted by height using the quicksort algorithm
Quicksort (also known as the partition-exchange sort) is an efficient sorting algorithm that works for items of any type for which a total order (i.e., "≤") relation is defined. Developed by Tony Hoare in 1959, it is still a commonly used algorithm for sorting in computer applications. On the average, quicksort requires O(n log n) comparisons to sort n items, which compares favorably to other popular sorting methods, including merge sort and heapsort. Unfortunately, on rare occasions the algorithm requires a worst-case O(n2) comparisons, while the other two methods remain O(n log n) in their worst cases. Still, when implemented well, quicksort can be about two or three times faster than its main competitors. Unlike merge sort, the standard implementation of quicksort does not preserve the order of equal input items (it is not stable), although stable versions of the algorithm do exist. ...more to come...