Which sorting algorithm has the best worst-case time complexity?
18 views
- QuickSort
- Bubble Sort
- Merge Sort (Correct Answer)
- Selection Sort
Explanation
Merge Sort guarantees O(n log n) time complexity in all cases due to its divide-and-conquer approach. Unlike QuickSort, it does not degrade to O(n²), making it reliable for large datasets.