Multiple choice technology programming languages

Complexity Of Bubble Sort..???

  1. O(n)

  2. O(log n)

  3. O(n^2)

  4. O(n log n)

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

Bubble Sort has a time complexity of O(n^2) in both average and worst cases because it uses nested loops - each element may need to be compared with every other element. In the best case (already sorted), it can be O(n) with optimization, but its standard complexity is quadratic. Option A is for linear algorithms, B for logarithmic, and D for efficient sorts like merge sort.