• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Inbuilt merge sort

 
Ranch Hand
Posts: 93
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i wanted to know if there is already an inbuilt function that can merge sort a very big file in java(at around 120 MB)
we just have to open the txt file in a function merge sort???
for example to sort a "unsorted.txt" like that:

Bacteria
Azorhizobium
Azorhizobium caulinodans
Buchnera aphidicola
Cellvibrio
Cellulomonas gilvus
Dictyoglomus
Dictyoglomus thermophilum
Methylophilus
Methylophilus methylotrophus
Pelobacter
Pelobacter carbinolicus
Phenylobacterium
Phenylobacterium immobile
Shewanella
Shewanella colwelliana
Shewanella putrefaciens
Shewanella hanedai
halophilic eubacterium NRCC 41227
halophilic eubacterium
Myxococcales
Myxococcaceae
Myxococcus
Myxococcus fulvus
Myxococcus xanthus
Corallococcus macrosporus
Angiococcus disciformis
Cystobacteraceae
etc........
 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know of a merge sort implemented in Java. Since your file is unsorted, you will have to read it into memory to sort. Why not just read it into any database product and do an "order by" on it?
 
Bartender
Posts: 732
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Unix or Linux platforms, you would just execute thecommand; no need to write a Java program to do it.
 
Marshal
Posts: 80653
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is one way to do it. But if you read the file into a List, you can use this to sort it. That uses an optimisation of merge sort.
 
reply
    Bookmark Topic Watch Topic
  • New Topic