Question: 6
(Choose 1 answer)
Given the Insertion sort algorithm (See picture)
If input = 3, 2, 4, 7, 1, 6, 5, after running the outer loop with i = 5, the order of the elements in the list is.
A. 1, 2, 3, 4, 7, 6, 5
B. 1, 2, 3, 4, 6, 7, 5
C. 1, 2, 3, 4, 7, 5, 6
D. 1, 2, 3, 7, 4, 6, 5
Procedure Insertionsort(a1,a2,..., an: integer)
for i = 2 to n do
j: = 1
while a; < a₁
j: = j+1
temp: = a₁
fork : i down to j+1
ax:= ak-1
a; := temp