Content deleted Content added
Citation bot (talk | contribs) m Alter: url. Add: volume. Removed URL that duplicated unique identifier. | You can use this bot yourself. Report bugs here.| Activated by User:Nemo bis | via #UCB_webform |
|||
Line 1:
In computer science, '''adaptive heap sort''' is a [[Comparison sort|comparison-based]] [[sorting algorithm]] of the [[Adaptive sort|adaptive sort family]]. It is a variant of [[Heapsort|heap sort]] that performs better when the data contains existing order. Published by [[Christos Levcopoulos]] and [[Ola Petersson]] in 1992, the algorithm utilizes a new measure of presortedness, ''Osc,'' as the number of oscillations.<ref name=":0">{{Cite journal|last=Levcopoulos|first=C.|last2=Petersson|first2=O.|date=1993-05-01|title=Adaptive Heapsort
== Heapsort ==
Heap sort is a sorting algorithm that utilizes [[binary heap]] data structure. The method treats an array as a complete [[binary tree]] and builds up a Max-Heap/Min-Heap to achieve sorting.<ref name=":1">{{Cite journal|last=Schaffer|first=R.|last2=Sedgewick|first2=R.|date=1993-07-01|title=The Analysis of Heapsort
# Build a Max-Heap(Min-Heap): put all the data into the heap so that all nodes are either greater than or equal (less than or equal to for ''Min-Heap'') to each of its child nodes.
Line 68:
== Measures of presortedness ==
Measures of presortedness measures the existing order in a given sequence.<ref>{{Cite journal|last=Mannila|first=Heikki|date=April 1985|title=Measures of Presortedness and Optimal Sorting Algorithms
=== Oscillations (''Osc'') ===
Line 74:
=== Other measures ===
Besides the original Osc measurement, other known measures include the number of inversions ''Inv'', the number of runs ''Runs'', the number of blocks ''Block'', and the measures ''Max'', ''Exc'' and ''Rem''. Most of these different measurements are related for adaptive heap sort. Some measures dominate the others: every Osc-optimal algorithm is Inv optimal and Runs optimal; every Inv-optimal algorithm is Max optimal; and every Block-optimal algorithm is Exc optimal and Rem optimal.<ref name=":2">{{Cite journal|last=Edelkamp|first=Stefan|last2=Elmasry|first2=Amr|last3=Katajainen|first3=Jyrki|date=2011|editor-last=Iliopoulos|editor-first=Costas S.|editor2-last=Smyth|editor2-first=William F.|title=Two Constant-Factor-Optimal Realizations of Adaptive Heapsort
== Algorithm ==
|