Quick Sort

Logic Overview Quicksort is a divide-and-conquer algorithm that sorts an array by partitioning it into two sub-arrays, then sorting the sub-arrays recursively. The key to its efficiency is the choice of the pivot - an element around which the partition is performed. Pivot: The choice of pivot can affect the performance. A good pivot can evenly divide the list into halves, leading to an evenly balanced recursion tree. The middle element is often chosen as the pivot to avoid the degraded performance on already sorted or nearly sorted data....

March 1, 2018 · 5 min