Sorting 10 GB file of integer with limited ram.
Problem
I have only x GB RAM in computer. I have a text file of 10 GB data.This file contains numbers. x is less than 10. How will I sort them?
Solution
Generic algorithm
Here is the generic algorithm:
split the file into parts (buffers) that you can sort in-memory 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 Example x = 4
[Read More]