**Problem : **
Trace the operation of bubble sort on the following list:
4, 7, 2, 5, 6

4, 7, 2, 5, 6 | The starting configuration |

4, 7, 2, 5, 6 | 4 < 7, so no swap is necessary |

4, 2, 7, 5, 6 | Swap the 2 and the 7 because 7 > 2 |

4, 2, 5, 7, 6 | Swap the 5 and the 7 becuase 7 > 5 |

4, 2, 5, 6, 7 | Swap the 6 and the 7 because 7 > 6. This is the end of the first pass. Notice how the 7 has "bubbled" up to the top of the list. |

2, 4, 5, 6, 7 | Swap the two and the 4 because 4 > 2. The list is now in sorted order; the algorithm will detect this on the next pass through the list when it makes no swaps. |

**Problem : **
What is the worst case scenario for bubble sort, and why?

**Problem : **
What simple modification could be made to the bubble sort algorithm that would make it
perform more efficiently on the case described above?

**Problem : **
What would happen if bubble sort didn't keep track of the number of swaps made on
each pass through the list?

Take a Study Break!