Time Complexity of Merge Sort
Coding
Sorting
Easy
Hint 1
Merge sort recursively splits the array in half and merges sorted halves.
Hint 2
Solve the recurrence .
Show worked solution
1. Set up the recurrence
Merge sort splits the array into two halves, recursively sorts each, and merges them in linear time.
2. Solve the recurrence
This recurrence falls under the Master theorem case where the work at each of the levels is , giving a total of .
Answer: O(n log n)
Related roles: Browse quant jobs