Which of the following sorting algorithms guarantees O(n log n) time in the worst case?
13 views
- Quick Sort
- Merge Sort (Correct Answer)
- Bubble Sort
- Insertion Sort
Explanation
Merge Sort divides the array recursively and merges sorted halves, guaranteeing O(n log n) in all cases. Quick Sort can degrade to O(n²) in worst case, and Bubble/Insertion Sort are O(n²) worst case.