Kizspy | Question: 16
(Choose 1 answer)
Given the Bubble sort algorithm (See picture)
If input 3, 2, 6, 4, 5, 1, find the order of the elements in the list after the third pass (i = 3).
FJOVERFLOW.COM
A. 2, 3, 1, 4, 5, 6
B. 2, 1, 3, 4, 5, 6
C. 3, 2, 1, 4, 5, 6
D. 1, 2, 3, 4, 5, 6
procedure Bubblesort(a1, a2,...,an: integer)
fori 1 to (n-1) do
for j 1 to (n-i) do
if a; > a++1 then
swap(aj, aj+1)