Multiple choice

The total number of comparisons in bubble sort is

  1. o(n)2

  2. o(n2)

  3. o(2n)

  4. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Bubble sort's worst-case time complexity is O(n²) because it makes n-1 passes, each comparing up to n-1 pairs of adjacent elements. The total comparisons approach (n-1) + (n-2) + ... + 1 = n(n-1)/2, which is O(n²). Option B correctly represents this quadratic complexity.