Easy# Bubble Sort Example: Number of Iterations

ALGOR-OABK69

Bubble sort is a comparison based sorting algorithm that iterates over the list repeatedly until sorted, each time comparing adjacent elements and swapping if they are in the wrong order.

Consider the following unsorted list.

$6 \quad 1 \quad 4 \quad 2 \quad9 \quad 5 \quad 3 \quad 7 \quad 8$

How many iterations of the outer loop of bubble sort are necessary to sort the list?