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!

AmandaRoosArt on Etsy - Rainbow Party Pack of 1x1 Clicker Fidgets

A new rainbow of clicker fidgets just hit my Etsy shop! ✨🌈☁️ Available from AmandaRoosArt on Etsy: https://amandaroosart.etsy.com