Welcome to Dream.In.Code
Become a Java Expert!

Join 150,418 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,101 people online right now. Registration is fast and FREE... Join Now!




what sort algorithm would be best?

 
Reply to this topicStart new topic

what sort algorithm would be best?

EquinoX
16 Mar, 2008 - 10:09 PM
Post #1

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
what algorithm would be the fastest in time in order to sort a large list that is almost sorted?? what I mean large here is larger than 100,000 elements in the list
User is offlineProfile CardPM
+Quote Post

fsloke
RE: What Sort Algorithm Would Be Best?
16 Mar, 2008 - 10:28 PM
Post #2

D.I.C Regular
***

Joined: 19 Dec, 2007
Posts: 258



Thanked: 4 times
My Contributions
It depends... No 100% sort algorithm is the best... Depend on what sample data you want to sort...
User is offlineProfile CardPM
+Quote Post

EquinoX
RE: What Sort Algorithm Would Be Best?
16 Mar, 2008 - 11:02 PM
Post #3

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
well I am sorting an integer.. any suggestions
User is offlineProfile CardPM
+Quote Post

AmitTheInfinity
RE: What Sort Algorithm Would Be Best?
16 Mar, 2008 - 11:22 PM
Post #4

C Surfing ∞
Group Icon

Joined: 25 Jan, 2007
Posts: 1,167



Thanked: 45 times
Dream Kudos: 125
My Contributions
I would suggest the Merge sort as it is stable and quite fast also. The quick sort is also one of the fastest but it is not stable and may take time equal to bubble sort in worst cases [like sorting the sorted list]. If proper care has been taken then quick sort can become the best choice, the complexity of code increases though.
User is offlineProfile CardPM
+Quote Post

EquinoX
RE: What Sort Algorithm Would Be Best?
16 Mar, 2008 - 11:48 PM
Post #5

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
okay I got it.. is there a variation of merge sort?? I've heard of natural merge sort but can never find the algorithm
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:20PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month