Algorithm


Quick Sort Algorithm:

  1. Start with an unsorted array.
  2. Select a "pivot" element from the array.
  3. Partition the array into two subarrays:
    1. Elements smaller than the pivot are placed in the left subarray.
    2. Elements larger than the pivot are placed in the right subarray.
  4. Recursively apply Quick Sort to the left and right subarrays.
  5. Combine the subarrays and pivot to form the sorted array.

Example:

Quick Sort Example

Fig. 1: Iteration by Iteration Visualization of Quick Sort

Note: Quick Sort is an efficient in-place sorting algorithm, particularly effective for large datasets.