Results 1 to 3 of 3

Thread: best sorting algorithm

  1. #1 best sorting algorithm 
    New Member
    Join Date
    Jun 2013
    Hi everyone!

    I do have some urgent questions about sorting algorithms, could you guys please help me?

    We have learnt the following algorithms:

    These are my questions:
    1) I know quicksort has in the avarage case a time complexity of nlog(n), mergesort always has nlog(n) and heapsort also always have nlog(n)
    But for sorting big data, which of these algorithms is the fastest? Because their time complexity is the same..?

    2) For sorting an array which elements are already sorted for a big part, what is the fastest algoritm? I was thinking about insertion sort, but i'm not quite sure..

    3) For an array which is sorted from high to low, what is the fastest algorithm to sort it from low to high?

    Thank you,

    Reply With Quote  


  3. #2  
    Forum Ph.D.
    Join Date
    Jul 2008
    New York State
    For 3) Start from the top and swap with bottom and move in (top and bottom) one step at a time, repeat till you reach the middle.

    Reply With Quote  

  4. #3  
    ▼▼ dn ʎɐʍ sıɥʇ ▼▼ RedPanda's Avatar
    Join Date
    Aug 2012
    Sort speeds can be affected by many things, including the coding language it is written in and the data types you are sorting.
    The best way to find out which is the fastest algorithm is to create some test data and try each sorting method in turn.

    This page
    Why is quicksort better than other sorting algorithms in practice? - Computer Science Stack Exchange
    goes into a lot of the detail about sort speeds.
    I used to have a link to a really good explanation of each different sorting method, but I appear to have lost it.

    Hopefully that will give you enough information to answer your questions.

    "And, behold, I come quickly;" Revelation 22:12

    "Religions are like sausages. When you know how they are made, you no longer want them."
    Reply With Quote  

Similar Threads

  1. sorting technique c/c++ code
    By shanebond in forum Computer Science
    Replies: 1
    Last Post: November 29th, 2010, 05:30 PM
  2. need help on algorithm
    By itsme in forum Computer Science
    Replies: 0
    Last Post: May 23rd, 2010, 09:53 PM
  3. algorithm help please
    By CSlocote in forum Mathematics
    Replies: 1
    Last Post: November 19th, 2009, 07:30 PM
  4. 'centrifugal sorting' problem?
    By lavoisier in forum Mathematics
    Replies: 4
    Last Post: July 8th, 2009, 03:23 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts