Algorithms and Data Structures · Middle · Question 5 of 75
What does partitioning do in quicksort?
- 1Splits the array into two equal halves by their index
- ✓Correct answer: Moves smaller values before the pivot and larger after it
- 3Merges two sorted parts of the array back into one
Explanation
After partitioning the pivot is in its final position, and the two sides are sorted recursively. The sides don't have to be equal in size, which is why the pivot choice matters.