Meaningless Drivel is fun!*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Which sort does sort() use?" Watch "Which sort does sort() use?" New topic

Which sort does sort() use?

Manish Malik

Joined: Jan 27, 2001
Posts: 19

Which sorting algorithm does sort() function use?

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

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
I agree. Here's the link:
subject: Which sort does sort() use?
Similar Threads
Long concatenated SQL stmts
Sorting in Java
how the the same operation with "pipe"...
chair oil
Hashmap in java