Algorithms and Data Structures · Middle · Question 1 of 75
How does merge sort work?
- 1Repeatedly swap neighbors until no swaps are needed
- ✓Correct answer: Split the array in halves, sort each half, then merge them
- 3Pick a pivot and move smaller values to its left
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.