• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which sort does sort() use?

 
Manish Malik
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which sorting algorithm does sort() function use?
 
Matt Senecal
Ranch Hand
Posts: 255
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which sort() are you referring to? java.util.Arrays.sort() uses a form of Quicksort.
Originally posted by Manish Malik:

Which sorting algorithm does sort() function use?

 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the one in Collections uses a mergesort. The API has more details. Always check the API. If you want more, you can always look at the source code inside src.jar.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic