31 thumbs up

The most efficient sort algorithm

I'm looking for the most efficient sort algorithm in pseudo code? Sort array of integers.




  • 595 views
Share Send to a friend Watch Report
 

Best Answer

 
1146 thumbs up

Here is a good site with nice examples of different algorithms:

http://www.go4expert.com/forums/showthread.php?s=16f008e057ecaaa3d79eb61eacc252c8&t=337

Here is the example of the shellsort:

void shellSort(int numbers[], int array_size)
{
  int i, j, increment, temp;

  increment = 3;
  while (increment > 0)
  {
    for (i=0; i < array_size; i++)
    {
      j = i;
      temp = numbers[i];
      while ((j >= increment) && (numbers[j-increment] > temp))
      {
        numbers[j] = numbers[j - increment];
        j = j - increment;
      }
      numbers[j] = temp;
    }
    if (increment/2 != 0)
      increment = increment/2;
    else if (increment == 1)
      increment = 0;
    else
      increment = 1;
  }
}


Posted 2 years ago ( permalink )
In reply to frank_d's question
Rated as
Best Answer
0
2

Helpful?

line
line
line


 

All Answers

 
31 thumbs up

Shell sort is a O(n^2). I've already seen one whose running time is blocked by O(nlogn). It's a recursive algorithem called Merge sort.


Posted 2 years ago ( permalink )
In reply to yoavdothan's answer
Rated as
#2 out of 2
0
0

Helpful?

line
line
line



 
189 thumbs up

Posted 2 years ago ( permalink )
In reply to frank_d's question
RattleHead was invited by Yedda to answer this question.

Rated as
#-2147483648 out of 2
0
0

Helpful?

line
line
line



Sign in to participate

Got an answer for frank_d? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

Other people asked questions on similar topics, check out the answers they received:


Asus

how do put windows on asus
Submitted by mspiggy521 5 months ago
  • viewed 498 times

Last answer posted 4 months ago by TennisTchr


Internet page display

have 2 computer winxp, win2000, both same problem I go to a page with options to go to another page, my computers show only 2 of 3 ...
Submitted by joe 2 years ago
  • viewed 916 times

Last answer posted 1 year ago by VSPrasad


Aebot removal - How to remove it?

aebot removal - How to remove it?
Submitted by ChuckTT 4 months ago
  • viewed 247 times

Last answer posted 4 months ago by CBrooker



» More...

Explore Related Posts in Forums

Ready made algorithm for futuristic computers?

triple algorithms

Deterministic Telic Algorithms

Imaginary Polynomial Time Algorithm for Subset sum Problem

Bad algorithms widespread in software, especially GUI (rant)

FFT algorithm for fixed number of samples

Quantum Computers

Energy and Quantum Computers are already real

8 Bit Computers and internet

Powered by
Feed - Subscribe to changes to this Q&A Blog
Copyright © 2006-2008, Yedda Inc. and respective copyright owners · CC License