In this web page: CS302 — External Sorting
Merge the resulting runs together into successively bigger runs, until the file is sorted.
As I quoted, how can we merge the resulting runs together??? We don’t have that much memory.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Imagine you have the numbers 1 – 9
And let’s suppose that only 3 fit in memory at a time.
So you’d break them into chunks of 3 and sort each, storing each result in a separate file:
Now you’d open each of the three files as streams and read the first value from each:
Output the lowest value
1, and get the next value from that stream, now you have:Output the next lowest value
2, and continue onwards until you’ve outputted the entire sorted list.