GATE 2024 DA – Question 30
Consider sorting the following array of integers in ascending order using an in-place Quicksort algorithm that uses the last element as the pivot.
| 60 | 70 | 80 | 90 | 100 |
|---|
The minimum number of swaps performed during this Quicksort is ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 0
Explanation
The array is already sorted. With the last element as the pivot, every other element is smaller than the pivot and already in place, so partitioning does not need to move any element, and the same holds for each sub-array that follows. The minimum number of swaps is 0.