What is the time complexity of merge sort?
2017
What is the time complexity of merge sort?
- A.
O(n)
- B.
O(n2)
- C.
O(nlogn)
- D.
O(logn)
Attempted by 106 students.
Show answer & explanation
Correct answer: C
Merge sort recursively divides the array and merges sorted halves. Its time complexity is O(n log n).