Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 846 Bytes

QuickSort.md

File metadata and controls

34 lines (22 loc) · 846 Bytes

Sort.QuickSort

QuickSort(array, [comparator], [step])

A QuickSort algorithm

Quicksort chooses an element of the array to serve as the pivot element and then moves two pointers in from the ends of the array until values are found that should be swapped to have a more sorted array this is then done recursively the subarray contained on each side of the pivot until fully sorted.

Arguments

  1. array (*[]): the input array
  2. [comparator] (Function): a function to compare 2 values *(defaults asc->desc)*
  3. [step] (Function): an optional function that gets applied at each step

Returns

(*): the sorted array