Description of the program: Your program will implement the Quicksort algorithm
ID: 669784 • Letter: D
Question
Description of the program: Your program will implement the Quicksort algorithm and should work with data supplied for testing using Dr.Racket. (if possible)
Functional Quicksort Algorithm:
quicksort (list)
if (list ==null) or (list has only one element) return list
otherwise
pivot = a random value from list
append (quicksort of left partition)
(quicksort of right partition)
NOTE: Remember, while the algorithm uses the name “list” for the argument, “list” is a reserved word.
There are a few details to work out here:
1. How to get a random value?
Save a random value in the list to pivot using the list-ref, random, and length functions.
2. How to get a partition?
We want the left partition to be those values less than the pivot and the right partition to be those values greater-than-or-equal-to the pivot. We can use the filter function to do this.