I do contract work for a living, which could include writing a program such as this. However, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project in any way you please and to keep all the profits from your endeavor.
What do you do when a sort is too big to fit in RAM? When Sun’s Collections. sort fails? You need some sort of external sort that uses intermediate disk space. I can think of four ways to implement this:
Then it does a K-way merge, reading from K files and writing the merged results of the first chunk in each file to another file. You read the files with a buffered reader with buffer size B, (where again the optimum size of B is determined by experiment.) Then it merges the second chunks etc. Each merge pass reduces the number of chunks to 1/K, and makes each chunk K times as large. You repeat until all the chunk are merged into one sorted one.
How cleverly you estimate values for N, K and B will largely determine the performance of your sort.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.58] | |||
| You are visitor number 11. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/project/externalsort.html | J:\mindprod\project\externalsort.html | ||