The External Heapsort

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]  Harold Lorin,et al.  Sorting and Sort Systems (The Systems programming series) , 1975 .

[2]  Heikki Mannila,et al.  A Simple Linear-Time Algorithm for in Situ Merging , 1984, Inf. Process. Lett..

[3]  Peter Dadam,et al.  A DBMS prototype to support extended NF2 relations: an integrated view on flat tables and hierarchies , 1986, SIGMOD '86.

[4]  Gaston H. Gonnet,et al.  Handbook Of Algorithms And Data Structures , 1984 .

[5]  Svante Carlsson A Variant of Heapsort with Almost Optimal Number of Comparisons , 1987, Inf. Process. Lett..

[6]  Lutz M. Wegner A generalized, one-way, stackless quicksort , 1987, BIT Comput. Sci. Sect..

[7]  Branislav Durian Quicksort Without a Stack , 1986, MFCS.

[8]  Edsger W. Dijkstra,et al.  Smoothsort, an Alternative for Sorting In Situ , 1982, Sci. Comput. Program..

[9]  Svante Carlsson,et al.  Average-case results on heapsort , 1987, BIT.

[10]  Hans-Werner Six,et al.  Sorting a Random Access File in Situ , 1984, Comput. J..

[11]  Ilkka J. Haikala,et al.  Virtual Memory Behavior of Some Sorting Algorithms , 1984, IEEE Transactions on Software Engineering.

[12]  Thomas Porter,et al.  Random insertion into a priority queue structure , 1974, IEEE Transactions on Software Engineering.

[13]  Donald E. Knuth,et al.  A one-way, stackless quicksort algorithm , 1986 .

[14]  Ernst-Erich Doberkat,et al.  Inserting a new element into a heap , 1981, BIT.

[15]  Ernst-Erich Doberkat,et al.  An Average Case Analysis of Floyd's Algorithm to Construct Heaps , 1984, Inf. Control..