Algorithms and Data Structures · Middle · Question 1 of 75

How does merge sort work?

Explanation

Merge sort divides until single elements remain, then merges sorted halves with two pointers. It's O(n log n) in every case and stable, but it needs O(n) extra memory for merging.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 1

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz