✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Recall selection sort:
SelectionSort(a[0..n-1])
i ← 0
WHILE i < n-1
min ← i
j ← i+1
WHILE j < n
IF a[j] < a[min]
min ← j
j = j + 1
swap the elements of a at positions i and min
i ← i + 1
Consider a selection sort of the following array:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| L | E | X | I | C | O | G | R | A | P | H | Y |
What is the state of the array at the end of the third iteration of the outer loop?