Beginner Data Structures & Algorithms
Q12 / 100

What is the time complexity of bubble sort in the worst case?

Correct! Well done.

Incorrect.

The correct answer is C) O(n²)

C

Correct Answer

O(n²)

Explanation

Bubble sort compares adjacent elements and swaps them if out of order, requiring up to n*(n-1)/2 comparisons in the worst case.

Progress
12/100