Question DSA-SORT-0031
EasyWith a flag that stops when a pass makes no swaps, what is bubble sort's best-case time complexity?
- A.
O(n)
- B.
O(n log n)
- C.
O(n²)
- D.
O(log n)
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Sorting question
With a flag that stops when a pass makes no swaps, what is bubble sort's best-case time complexity?
O(n)
O(n log n)
O(n²)
O(log n)
Sign up free to see the answer and a step-by-step explanation.