Join Joe Marini for an in-depth discussion in this video Implement the quicksort, part of Programming Foundations: Algorithms.
- So now that we've seen the Quicksort theory,…let's actually implement the Quicksort for ourselves.…So here in VS code, I'm going to open up…the quicksort_start.py file.…And you can see, I already have some code…for a list of items that need to be sorted.…And I've already filled in the main Quicksort function,…so let't scroll down a little bit.…And down here, I print out the list of unsorted items,…and then call the Quicksort function…and then print out the finished sorted list.…
So since all of the work gets done in…the partition function, that's what…we are going to fill in.…And, again, just a quick recap,…remember that as long as we have the first and last indexes,…the first is less than last, we can calculate a pivot index…and then Quicksort the two partitions.…And we do this recursively until we no longer have…any partitions left to Quicksort.…So here, in the partition function,…I already have some code that establishes…the pivot value.…
And again, I'm just choosing the first position,…and then we're going to establish the lower…
Author
Released
11/8/2018- Measuring algorithm performance
- Working with data structures such as arrays, stacks, and queues
- Looping and recursion
- Sorting data
- Searching data
- Filtering and value counting with hash tables
Skill Level Beginner
Duration
Views
Related Courses
-
Programming Foundations: Design Patterns
with Elisabeth Robson2h 19m Intermediate -
Programming Foundations: Data Structures (2014)
with Simon Allardice2h 29m Intermediate
-
Introduction
-
What you should know1m 35s
-
1. Overview
-
What are algorithms?2m 44s
-
-
2. Common Data Structures
-
Arrays2m 29s
-
Linked lists2m 36s
-
Linked lists walkthrough7m 35s
-
Stacks and queues2m 43s
-
Hash tables7m 59s
-
3. Recursion
-
Understanding recursion3m 38s
-
Simple recursion example3m 9s
-
Power and factorial4m 14s
-
-
4. Sorting Data
-
Overview of sorting2m 4s
-
The bubble sort5m 8s
-
The merge sort2m 24s
-
Implement the merge sort5m 10s
-
The quicksort3m 31s
-
Implement the quicksort5m 39s
-
-
5. Searching Data
-
Unordered list search3m 45s
-
Ordered list search5m 30s
-
-
6. Other Algorithms
-
Find max value recursively3m 44s
-
Conclusion
-
Next steps1m 18s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Implement the quicksort