This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
The External Heapsort
July 1989 (vol. 15 no. 7)
pp. 917-925

Heapsort is an internal sorting method which sorts an array of n records in place in O(n log n) time. Heapsort is generally considered unsuitable for external random-access sorting. By replacing key comparisons with merge operations on pages, it is shown how to obtain an in-place external sort which requires O(m log m) page references, where m is the number of pages which the file occupies. The new sort method (called Hillsort) has several useful properties for advanced database management systems. Not only does Hillsort operate in place, i.e., no additional external storage space is required assuming that the page table can be kept in core memory, but accesses to adjacent pages in the heap require one seek only if the pages are physically contiguous. The authors define the Hillsort model of computation for external random-access sorting, develop the complete algorithm and then prove it correct. The model is next refined and a buffer management concept is introduced so as to reduce the number of merge operations and page references, and make the method competitive to a basic balanced two-way external merge. Performance characteristics are noted such as the worst-case upper bound, which can be carried over from Heapsort, and the average-case behavior, deduced from experimental findings. It is shown that the refined version of the algorithm which is on a par with the external merge sort.

[1] T. O. Alanko, H. H. A. Erkiö, and I. J. Haikala. "Virtual memory behavior of some sorting algorithms,IEEE Trans. Software Eng., vol. SE-10. no. 4, pp. 422-431, July 1984.
[2] S. Carlsson, "HEAPS," Doctoral dissertation, Lund Univ., Sweden, 1986.
[3] S. Carlsson, "Average-case results on Heapsort,"BIT, vol. 27, no. 1, pp. 2-17, 1987.
[4] S. Carlsson, "A variant of Heapsort with almost optimal number of comparisons,"IPL, vol. 24, no. 4, pp. 247-250, Mar. 1987.
[5] P. Dadamet al., "A DBMS prototype to support extended NF2 relations: An integrated view on flat tables and hierarchies," inProc. ACM SIGMOD, 1986, pp. 356-367.
[6] E. W. Dijkstra, "Smoothsort, an alternative for sorting in situ."Sci. Comput. Program., vol. 1, pp. 223-233, 1982, and vol. 2, p. 85, 1982.
[7] E. E. Doberkat, "Inserting a new element into a heap,"BIT, vol. 21, pp. 255-269, 1981.
[8] E. E. Doberkat, "Deleting the root of a heap,"Acta Inform., vol. 17, pp. 245- 265, 1982.
[9] E. E. Doberkat, "An analysis of Floyd's algorithm to construct heaps,"Inform. Contr., vol. 61, no. 2, pp. 114-131, 1984.
[10] B. Durian, "Quicksort without a stack," inProc. Math. Foundations Comput. Sci., Bratislava, CSSR, Aug. 1986.
[11] R. W. Floyd, "Treesort,"Commun. ACM, vol. 7, p. 701, 1964.
[12] G. H. Gonnet,Handbook of Algorithms and Data Structures. Reading, MA: Addison-Wesley, 1984.
[13] H. Bing-Chao and D. E. Knuth, "A one-way, stackless Quicksoft algorithm,"BIT, vol. 26, pp. 127-130, 1986.
[14] D. E. Knuth,The Art of Computer Programming, Vol. 3, Reading, MA: Addison-Wesley, 1973.
[15] H. Lorin,Sorting and Sort Systems. Reading, MA: Addison-Wesley, 1975.
[16] H. Mannila and E. Ukkonen, "A simple linear-time algorithm for in situ merging,"Inform. Processing Lett., vol. 18, no. 4, pp. 203- 208, 1984.
[17] T. Porter and I. Simon: Random insertion into a priority queue structure,"IEEE Trans. Software Eng., vol. SE-1, pp. 292-298, 1975.
[18] H. W. Six and L. Wegner, "Sorting a random access file insitu," Comput. J., vol. 27, no. 3, pp. 270-275, 1984.
[19] L. Wegner, "The Linksort family--Design and analysis of fast, stable Quicksort derivatives," Dissertation, Inst. Angew. Informatik, Univ. Karlsruhe, West Germany, Rep. 123, Feb. 1983.
[20] L. Wegner, "A generalized, one-way, stackless Quicksort,"BIT, vol. 27, no. 1, pp. 44-48, 1987.
[21] J. W. J. Wiliams, "Algorithm 232, Heapsort,"Commun. ACM, vol. 7, no. 6, pp. 347-348, June 1964.

Index Terms:
performance characteristics; external Heapsort; sorting method; random-access sorting; Hillsort; database management systems; page table; buffer management concept; merge operations; page references; worst-case upper bound; sorting; storage management
Citation:
L.M. Wegner, J.I. Teuhola, "The External Heapsort," IEEE Transactions on Software Engineering, vol. 15, no. 7, pp. 917-925, July 1989, doi:10.1109/32.29490
Usage of this product signifies your acceptance of the Terms of Use.