Data Structures and Algorithm Analysis in C++, Third Edition by Clifford A. Shaffer

Data Structures and Algorithm Analysis in C++, Third Edition by Clifford A. Shaffer

Author:Clifford A. Shaffer [Shaffer, Clifford]
Language: eng
Format: epub
ISBN: 9780486172620
Publisher: INscribe Digital
Published: 2012-10-11T04:00:00+00:00


Figure 8.6 A simple external Mergesort algorithm. Input records are divided equally between two input files. The first runs from each input file are merged and placed into the first output file. The second runs from each input file are merged and placed in the second output file. Merging alternates between the two output files until the input files are empty. The roles of input and output files are then reversed, allowing the runlength to be doubled with each pass.

Repeat steps 2 through 5, using the original output files as input files. On the second pass, the first two records of each input run file are already in sorted order. Thus, these two runs may be merged and output as a single run of four elements.

Each pass through the run files provides larger and larger runs until only one run remains.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.