login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A350426
a(n) is the maximum number of key comparisons required to sort n records with distinct keys using heapsort (Algorithm H in Don Knuth's TAOCP Vol. 3).
3
1, 3, 7, 12, 17, 22, 29, 37, 44, 51, 59, 66, 73, 80
OFFSET
2,2
COMMENTS
There are two places in the algorithm where the keys are compared. The first is in step H4 [Find larger child] and the second in step H6 [Larger than K?]. The sequence shows the maxima of the counts of these comparisons, determined over all n! possible orders of the records.
a(16) >= 90.
REFERENCES
D. E. Knuth, The Art of Computer Programming Second Edition. Vol. 3, Sorting and Searching. Chapter 5.2.3 Sorting by Selection, Page 145. Addison-Wesley, Reading, MA, 1998.
CROSSREFS
A350569 contains a table with the maximum and average number of comparisons for the original algorithm and for its modified version.
Sequence in context: A192740 A310246 A310247 * A332263 A376998 A310248
KEYWORD
nonn,more
AUTHOR
Hugo Pfoertner, Jan 05 2022
STATUS
approved