Question text in black, answers in blue.
Use the code from lecture.
findPartitionon page 6 of Lecture #25 is correct. It runs the while loop until
rightare next to each other, then it swaps the items in locations
right. Shouldn't it instead swap
minhas to hold a small element after the partition?
No, I think you are overlooking the fact that
the while loop runs until the condition
left < right
is false. You are correct that the leftmost of the two
finger positions, containing the smaller element, should be swapped
min. But because
have passed one another, that position is now called
Last modified 7 December 2011