Here is the problem: I have only 1GB RAM in computer. I have a text file of 10 GB data.This file contains numbers. How will I sort them?
Adding some more details.
-They are all integers like 10000, 16723998 etc. -same integer values can be repeatedly appearing in the file.
Suppose we have to sort a 1GB file of random integers and the available ram size is 200 Mb, how will it be done? The easiest way to do this is to use external sorting. We divide our source file into temporary files of size equal to the size of the RAM and first sort these files.
Which sorting technique will be most appropriate? Explanation: The data can be sorted using external sorting which uses merging technique.
split the file into parts (buffers) that you can sort in-place
then when all buffers are sorted take 2 (or more) at the time and merge them (like merge sort) until there's only 1 buffer remaining which will be the sorted file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With