Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sorting of a large file  RSS feed

 
Gunjan Rathi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have to sort a Comma separated value file which is of size more that 2 Gb.Which sorting method should I use??
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
I think the answer to your question is "All of them".
Sorting 2GB of anything is going to take a lot of time and resources. Different sorting algorithms work better for different distributions of data. You will need to get smart on sorting and try some alternatives before you can determine the best answer for your data. Your best bet is probably to divide and conquer. Split your file into managable chunks with one sort, sort the chunks, then merge all the chunks back together.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should help you: http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!