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

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




the best sorting algorithm

 
Reply to this topicStart new topic

the best sorting algorithm

EquinoX
14 Mar, 2008 - 09:20 AM
Post #1

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
I am asked to sort an array of the size r x c, say that r is 2000 and c is 25.. I have to sort each of the column in this 2d array. What do you guys thing is the best sorting algorithm for this problem?? I know that standard comparison algorithm might not work, such as buble sort, selection sort, and linear sort.. I am thinking of using Merge Sort ...
User is offlineProfile CardPM
+Quote Post

GWatt
RE: The Best Sorting Algorithm
14 Mar, 2008 - 09:36 AM
Post #2

human inside
Group Icon

Joined: 1 Dec, 2005
Posts: 2,360



Thanked: 31 times
Dream Kudos: 500
My Contributions
quicksort is the fastest sorting algorithm.
User is online!Profile CardPM
+Quote Post

EquinoX
RE: The Best Sorting Algorithm
14 Mar, 2008 - 09:38 AM
Post #3

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
oh yeah? I think it also depends too on what kind of list do you have.. I have kind of a random list..
User is offlineProfile CardPM
+Quote Post

1lacca
RE: The Best Sorting Algorithm
14 Mar, 2008 - 10:30 AM
Post #4

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
For your and other in memory sorting) problem quicksort is the best.
If you have to sort data on hard drive, or when it takes more time to access an item, then quicksort is usually not optimal, or must be combined with some other methods.
User is offlineProfile CardPM
+Quote Post

EquinoX
RE: The Best Sorting Algorithm
14 Mar, 2008 - 01:25 PM
Post #5

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
well no I am not doing an external sort, as taking data from the hard drive.. not that large though.. so quicksort? can any modifications be made to quick sort so that it performs better?
User is offlineProfile CardPM
+Quote Post

1lacca
RE: The Best Sorting Algorithm
14 Mar, 2008 - 06:18 PM
Post #6

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
quicksort is an algorithm, it has many implementations. I think you can not turbo the algoritm itself, but you can optimize your implementation.
User is offlineProfile CardPM
+Quote Post

EquinoX
RE: The Best Sorting Algorithm
14 Mar, 2008 - 06:28 PM
Post #7

D.I.C Head
**

Joined: 19 Jan, 2007
Posts: 63


My Contributions
okay I got it, would it be more faster if for each step in the column sort I use different algorithms, instead of just quick sort for all of them
User is offlineProfile CardPM
+Quote Post

1lacca
RE: The Best Sorting Algorithm
15 Mar, 2008 - 02:01 AM
Post #8

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
Here you can check sorting algorithms
About your question: I don't think that using different algorithms would make any difference.
User is offlineProfile CardPM
+Quote Post

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

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