(24)
(Choose 1 answer)
The following is the main part of bubble sort pseudocode:
do
swapped := false
for i:= 0 to n-2 if a[i] > a[i+1] then
swap(a[i],a[i+1])swapped := true
end if
end for
while swapped
Consider the list of ten integers below:6, 3, 9, 10, 1, 8, 0, 2, 7, 5
What is the list after the FIRST iteration (for i = 0 to n-2) in a bubble sort? (sorting from smallest to largest).
A. 3, 6, 9, 8, 1, 0, 2, 7, 5, 10
B. 3, 6, 9, 0, 1, 8, 2, 7, 5, 10
C. 3, 6, 9, 1, 8, 0, 2, 5, 7, 10
D. 3, 6, 9, 1, 8, 0, 2, 7, 5, 10