Given the following array of integers:
{ 17, 13, 15, 16, 12, 19, 21 }
We sort the array using bubble sort in the ascending order from left to right.
Here you see the results after performing each iteration:
#1: [13, 15, 16, 12, 17, 19, 21]
#2: [13, 15, 12, 16, 17, 19, 21]
#3: [13, 15, 12, 16, 17, 19, 21]
#4: [13, 12, 15, 16, 17, 19, 21]
#5: [12, 13, 15, 16, 17, 19, 21]
#6: [12, 13, 15, 16, 17, 19, 21]
Find the first wrong iteration.
Tip: don't mistake iteration for a swap