

A350568


a(n)/n! is the average number of key comparisons required to perform an indirect sort of n records with distinct keys using a twoway merge (A. D. Woodall's mergesort).


2



2, 19, 130, 992, 8145, 73665, 725630, 7840280, 92297011, 1176802235, 16129154724, 236335661166, 3685509077329, 60981635041557
(list;
graph;
refs;
listen;
history;
text;
internal format)



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
  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 164166. AddisonWesley, Reading, MA, 1998.


LINKS



CROSSREFS



KEYWORD

nonn,more


AUTHOR



STATUS

approved



