Skip to main content

Two Versions of Quicksort with Python

I've been taking the Data Structures & Algorithms in Python class on Udacity.com. Lately, I've been working on implementing an in-place Quicksort two different ways. 

The first way follows the way they explained it in the class video. This version involves moving the pivot after each comparison:

The second way is based on a visualization they linked to from the lecture and this tutorial. It moves the pivot after all comparisons for each partition have been made, eliminates the need for the "j" variable that I have in the first version, and is a few lines shorter than the first version, but it is harder for me understand intrinsically:

Comments

Popular posts from this blog

Fall Hiking - October 2025 - Utah

 

New 3D printing model! Circle Mosaic Rainbow Puzzle.

Available on MakerWorld: https://makerworld.com/en/models/1960502-circle-mosaic-rainbow-puzzle Public domain for your use. If you are selling online, I would appreciate if you mention that you got the model from me, Amanda Roos. Enjoy! Fits snuggly in 3x3 inch bags!

Halloween Minis!

 Thanks to everyone for boosting my mini Halloween 3D print models on MakerWorld! They are my most popular models yet! Link to pumpkins: https://makerworld.com/models/1746189 Link to ghosts: https://makerworld.com/models/1743420 I also got a five star review of my rainbow mini ghost packs on my Etsy shop! https://amandaroosart.etsy.com