Skip to main contentSkip to solution

How many passes are required to sort a list of 6 elements using bubble sort?

Solution

✅ Correct Option: 1

Each pass of bubble sort places the largest remaining element at its final position at the end of the list. After n−1n-1 passes, the last remaining element is automatically in place, so no separate pass is needed for it.

For n=6n = 6: n−1=6−1=5n - 1 = 6 - 1 = \boxed{5}

The n−1n-1 passes are the worst case. With a swap flag, the sort can stop earlier if a pass makes no swaps.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question