Exercise

Implementing the quicksort algorithm

In this exercise, you will implement the quicksort algorithm to sort a list of numbers.

In the first step, you will implement the partition() function, which returns the index of the pivot after having processed the list of numbers so that all the elements that are to the left of the pivot are less than the pivot and all the elements that are to the right of the pivot are greater than the pivot.

In the second step, you will implement the quicksort() function, which will call the partition() function.

Instructions 1/2

undefined XP
    1
    2
  • Iterate until the value pointed by left_pointer is greater than pivot or left_pointer is greater than last_index.
  • Swap the values for the elements located at the left_pointer and right_pointer.