Total swaps from inversions

Bubble sort sorts the list 3, 7, 2, 6, 1 into ascending order, comparing adjacent pairs from left to right and swapping a pair whenever the left value is larger. How many swaps does it make in total, from the starting list to the fully sorted list? Give your answer as a whole number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Bubble Sort Questions: