Physics I / Searching and sorting ideas
Practice question · Put in order

Order the steps of merge sort on [3, 1, 4, 2].

Hints
  1. Splitting must finish before any merging can begin.
  2. The merge step combines pairs that are already in order.
Show the answer
  1. Split into [3,1] and [4,2]
  2. Split further into [3],[1] and [4],[2]
  3. Merge pairs: [1,3] and [2,4]
  4. Merge final halves: [1,2,3,4]
Why

Merge sort recursively splits, then merges sorted sub-arrays bottom-up.

Read the lesson: Searching and sorting ideas →

Practise Searching and sorting ideas

The app has 8 more questions on this lesson, and keeps your place in the course. Physics I is free to start.

More questions on Searching and sorting ideas