🎴 Flashcard Mode

Computer Science Theory

Card1 / 15
Mastered0
Review0
QuestionClick to flip

Which sorting algorithm has a worst-case time complexity of O(n^2) but a best-case time complexity of O(n)?

AnswerClick to flip back
A
Bubble Sort
💡 Explanation:

Bubble Sort has a worst-case time complexity of O(n^2) when the input is already sorted in reverse order, but it has a best-case time complexity of O(n) when the input is already sorted.

Change Mode