If you're in a hurry to get something working, and will have time to work on a faster method later, consider a brute force approach: only sort what you
can fit in memory, and then merge the resulting sorted files.
"It's not the Zen way, but it gets the job done." -- Garrison Keiler