I need help with this, please. I started from the pivot (left side) look for a number greater than the pivot and start from the right side looking for a number less than the pivot then we swap these two, the pivot is 59, I reached a step where I swapped the pivot 59 with 13 since the two indices cross (coming from left and coming from right) and at that point we stop and we swap the pivot (59) with what we got coming from the right, but the problem is when i did that to the right of 59 is 42 which is smaller. I have a demonstration of how the answer must be in each blank but for a different example. Note that by the end (blank 3) not everything must be sorted, that's fine. I attached the question and the demonstration how each blank should be. Please provide what the answers for each blank must be and why
I need help with this, please. I started from the pivot (left side) look for a number greater than the pivot and start from the right side looking for a number less than the pivot then we swap these two, the pivot is 59, I reached a step where I swapped the pivot 59 with 13 since the two indices cross (coming from left and coming from right) and at that point we stop and we swap the pivot (59) with what we got coming from the right, but the problem is when i did that to the right of 59 is 42 which is smaller. I have a demonstration of how the answer must be in each blank but for a different example. Note that by the end (blank 3) not everything must be sorted, that's fine.
I attached the question and the demonstration how each blank should be. Please provide what the answers for each blank must be and why
Trending now
This is a popular solution!
Step by step
Solved in 3 steps