GeeCON Prague 2014*
The moose likes Java in General and the fly likes Which sort does sort() use? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Which sort does sort() use?" Watch "Which sort does sort() use?" New topic
Author

Which sort does sort() use?

Manish Malik
Greenhorn

Joined: Jan 27, 2001
Posts: 19

Which sorting algorithm does sort() function use?

Manish
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
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?


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
GeeCON Prague 2014
 
subject: Which sort does sort() use?