Quicksort Proficiency Exercise Help Page

This exercise asks you to reproduce the high-level behavior of the Quicksort algorithm on a random sequence of 10 values. Initially you will be presented with an array of numbers. Follow the steps below to complete the exercise.

Steps:

  1. Select the pivot
    1. Add the index number of the right-most element in the list with the index of the left-most element and divide by 2.
    2. If necessary, truncate the result (drop the decimal value) to create an integer.
    3. This integer is the index of the pivot. Click it.

  2. Move the pivot to the end

  3. Select the range to partition
    1. Click an element to select it as the left bound. An blue indicator should appear above the value you selected.
    2. Once the left bound has been set, click another element to select it as the right bound. An red indicator should appear above this value.


  4. Partition the selected range

  5. Move the pivot to its final sorted location

  6. Mark the pivot as sorted

  7. Repeat as necessary on sublists
    1. If there are uncolored elements to the left of the sorted pivot element, repeat this process on the unsorted left sublist.
    2. Once all values to the left are sorted, repeat the process as necessary on the unsorted right sublist.

Other Controls: