Quick Sort

Cards (2)

  • Quicksort is a divide and conquer algorithm as:
    • It decomposes data sets into smaller subsets
    • Then sorting each split subset
    • Until each subset is sorted
    • Then combine the subsets to provide a solution
  • Steps of how quick sort works:
    • Choose a pivot // identify start and end pointers
    • Compare each element to the pivot // compare start and end pointers
    • Put items < pivot in the left sublist
    • Put items > pivot in the right sublist
    • Choose a pivot in each sublist
    • If start pointer is larger than end pointer
    • Then swap data items around
    • And repeat the process until each item becomes a pivot