Back

Quick Sort Visualization Using JavaScript

QuickSort

Quicksort is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. It is still a commonly used algorithm for sorting.

When implemented well, it can be about two or three times faster than its main competitors, Merge sort and Heapsort.

Quicksort is also known as a comparison sort, meaning that it can sort items of any type for which a "less-than" relation (formally, a total order) is defined. In efficient implementations it is not a stable sort, meaning that the relative order of equal sort items is not preserved. Quicksort can operate in-place on an array, requiring small additional amounts of memory to perform the sorting.

Pseudocode algorithm quicksort(A, lo, hi) is if lo < hi then p := partition(A, lo, hi) quicksort(A, lo, p – 1) quicksort(A, p + 1, hi) algorithm partition(A, lo, hi) is pivot := A[hi] i := lo - 1 for j := lo to hi - 1 do if A[j] ≤ pivot then i := i + 1 swap A[i] with A[j] swap A[i+1] with A[hi] return i + 1

Add
Sort Desc Order