From the course: Programming Foundations: Algorithms

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Implementing the quicksort

Implementing the quicksort

- [Instructor] Okay, we've seen the Quicksort theory. Let's actually implement it ourselves. So here in my editor, I'm going to open up the Quicksort start position. Here's my data that I'm going to be sorting. Here is my Quicksort function. And if we scroll all the way down, you can see that I'm printing out the unsorted data, calling the Quicksort function on the list to be sorted, and the dimensions of the list. So index of zero all the way up to the length of the items we want to sort. And then I'm going to print out the result. Up here in Quicksort, I've already filled out the Quicksort function, because this really isn't where the magic happens. I'm going to call the partition function. That's what we're going to fill out. Because remember in the Quicksort, that's where everything happens. So we calculate the pivot index by calling partition, and then we call Quicksort recursively on the dataset with our newly…

Contents