Which of the following sorting algorithms has the lowest worst-case complexity?
2007
Which of the following sorting algorithms has the lowest worst-case complexity?
- A.
Merge sort
- B.
Bubble Sort
- C.
Quick Sort
- D.
Selection Sort
Attempted by 327 students.
Show answer & explanation
Correct answer: A
Answer: Merge sort
Reasoning:
Merge sort — worst-case O(n log n). The algorithm always divides the array and merges sorted halves, guaranteeing O(n log n) time.
Quick Sort — worst-case O(n^2), average-case O(n log n). The worst-case arises with poor pivot choices (for example, already sorted input without pivot protection).
Bubble Sort — worst-case O(n^2). Repeated pairwise swaps lead to quadratic time on large inputs.
Selection Sort — worst-case O(n^2). Selecting the minimum repeatedly results in quadratic time regardless of initial ordering.
Conclusion: Among the listed algorithms, Merge sort has the lowest worst-case time complexity (O(n log n)), while the others can take O(n^2) in the worst case.