Question DSA-SORT-0003
EasyWhat is the time complexity of merge sort in every case?
- A.
O(n)
- B.
O(n log n)
- C.
Show answer and explanation
Answer: B
It always splits in half and merges in linear time, whatever the input order.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Sorting question
What is the time complexity of merge sort in every case?
O(n)
O(n log n)
Answer: B
It always splits in half and merges in linear time, whatever the input order.
O(n²)
O(log n)