Polyphase merge sort

From Wikipedia, the free encyclopedia

A polyphase merge sort is an algorithm which decreases the number of runs at every iteration of the main loop by merging runs in pairs. Typically, a merge sort splits items into groups then recursively sorts each group. Once the groups are sorted, they are merged into a final, sorted sequence.

Polyphase merge sorts are ideal for sorting and merging large files. Two pairs of input and output files are opened as file streams. At the end of each iteration, input files are deleted, output files are closed and reopened as input files. The use of file streams makes it possible to sort and merge files which can not be loaded into the computer's main memory.

[edit] See also

[edit] References

[edit] External links