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: