OFFSET
2,1
COMMENTS
There are six places in the Algol 60 procedure mergesort where the keys are compared. The sequence is the sum of the counts of these comparisons, taken over all n! possible orders of the records.
The following table shows the maximum and average number of key comparisons.
.
n Worst case
| A350567(n)
| | Average
| | a(n)/n!
| | | Average/
| | | (n*log(n))
2 1 1.000 0.721
3 4 3.167 0.961
4 6 5.417 0.977
5 10 8.267 1.027
6 13 11.313 1.052
7 17 14.616 1.073
8 20 17.997 1.082
9 25 21.606 1.093
10 29 25.435 1.105
11 34 29.481 1.118
12 38 33.672 1.129
13 43 37.953 1.138
14 47 42.276 1.144
15 52 46.634 1.148
REFERENCES
D. E. Knuth, The Art of Computer Programming Second Edition. Vol. 3, Sorting and Searching. Chapter 5.2.4 Sorting by Merging, Pages 164-166. Addison-Wesley, Reading, MA, 1998.
LINKS
A. D. Woodall, An internal sorting procedure using a two-way merge, Algorithm 45, The Computer Journal, Volume 13, Number 1, February 1970, Algorithms Supplement, pp. 110-111.
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Hugo Pfoertner, Jan 09 2022
STATUS
approved