I need to sort huge binary files that won’t fit into memory. It’s no option to use a sort algorithm and continuously read/write from I/O device. Is there any possibility to use something like a memory mapped file?
Share
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.
This is a solved problem, as explained on this wiki page: http://en.wikipedia.org/wiki/External_sorting
Basically, read in some set amount, sort it, save into a file, and repeat.
Then, read in a smaller amount from each file, sort these, and continue until done.
UPDATE:
You may want to look at the java code he uses, it sounds like he solved what you need.
http://www.codeodor.com/index.cfm/2007/5/10/Sorting-really-BIG-files/1194