Article: Quicksort algorithm tutorialQuestion (James Ten Eyck): Your java algorithm for Quicksort does not seem to work. At the end of the first partition, on sorting the following numbers, you have an incorrection partition:
1 1 5 5 1 4 8
The first 5 becomes left, and the 4 becomes right. After swapping you have:
1 1 4 5 1 5 8
The first 5 (fourth index) is now left, and the right-most 1 is now right. Those get swapped, and i increases and j decreases.
1 1 4 1 5 5 8
now 1 is right, and 5 is left (4th and 5th elements, respectively). Returning right leaves 1 as the partition. That does not work because 4 is to the left of the partition but is greater than 1. Am I missing something here?