What is the most efficient way to choose a pivot in Quick Sort Algorithm?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MoeketsiM
    New Member
    • Oct 2012
    • 1

    What is the most efficient way to choose a pivot in Quick Sort Algorithm?

    Which method is better and more efficient than the other, to choose a pivot randomly or to choose it by selecting three indexes (index 0, index n/2 and index n) and taking the middlemost number between the three?
    Last edited by Dormilich; Oct 12 '12, 08:31 AM. Reason: ortography
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I think that there are several variants of Quicksort, which differ in exactly that: how to choose the pivot.

    though in general (I have read) that Quicksort is fastest if the sub-lists are about equally large.

    Comment

    • dianagaby2002
      New Member
      • Jul 2012
      • 9

      #3
      We were using the n/2 at univ.

      Comment

      Working...