What is the time complexity of Merge Sort?

Quick Overview

Asks for the time complexity of merge sort in the best, average and worst case and where the bound comes from. It tests whether a candidate can derive the cost from the recurrence or recursion tree, account for the merge step and its extra memory, and compare merge sort with other common sorting algorithms.

What is the time complexity of Merge Sort?

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: easy

Interview Round: Other

What is the time complexity of merge sort? A complete answer gives the bound for the best, average and worst case and shows where it comes from. ```hint Count the work per level Draw the recursion tree. Ask how many levels it has and how much merging work happens across one whole level. ``` ### What a Strong Answer Covers - The bound in the best, average and worst case, and whether they differ - A derivation from the recurrence or the recursion tree - The cost of the merge step and the extra memory it needs - How the bound compares with other common sorts and with the lower bound for comparison sorting ### Follow-up Questions - What is the space complexity of merge sort, and can it be reduced? - Why does quicksort often run faster than merge sort in practice despite its worse worst case? - Is merge sort stable, and when does that matter? - How would you sort a file that is too large to fit in memory?

Overview: Asks for the time complexity of merge sort in the best, average and worst case and where the bound comes from. It tests whether a candidate can derive the cost from the recurrence or recursion tree, account for the merge step and its extra memory, and compare merge sort with other common sorting algorithms.

General logo
General
Nov 24, 2026
easySoftware EngineerOtherSoftware Engineering Fundamentals
0
0

What is the time complexity of merge sort? A complete answer gives the bound for the best, average and worst case and shows where it comes from.

What a Strong Answer Covers Guidance

  • The bound in the best, average and worst case, and whether they differ
  • A derivation from the recurrence or the recursion tree
  • The cost of the merge step and the extra memory it needs
  • How the bound compares with other common sorts and with the lower bound for comparison sorting

Follow-up Questions Guidance

  • What is the space complexity of merge sort, and can it be reduced?
  • Why does quicksort often run faster than merge sort in practice despite its worse worst case?
  • Is merge sort stable, and when does that matter?
  • How would you sort a file that is too large to fit in memory?