What is the worst-case time complexity of merge sort?
- A O(n)
- B O(n^2)
- C O(n log n)
- D O(log n)
Explanation
Merge sort always divides the array in half and merges in linear time, so its worst-case time is O(n log n).
What is the worst-case time complexity of merge sort?
Merge sort always divides the array in half and merges in linear time, so its worst-case time is O(n log n).