Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

Quick sort

A quick sort is an efficient sorting algorithm that uses a recursive divide-and-conquer algorithm.

  1. An item in the list (called the pivot) is picked
  2. Smaller values are moved before the pivot (left), and greater items after (right). This is called the partition operation.
  3. Recursively apply the above steps to the left and right lists.

Using a random index or a median of three approach for the pivot ensures worst case behaviour on already sorted arrays is avoided.

Characteristics

Complexity

🔔 Complexity is considered in terms of worst case.

Time complexity

Notes
Θ(n log n)

Space complexity

Notes
Θ(n log n) The in-place version of quick sort
Θ(n) In this naive implementation three temporary lists are created and concatenated recursively