Open the editor

Computer science · High school

Merge Sort Slides

Free animated slides, ready to teach: 6 slides where every step appears on a click and the diagrams move. Play them right here, present them full screen, or copy them into your account to edit.

A real Tracé deck playing in your browser. No account needed.

What the lesson covers

Merge sort splits a list into single items and merges them back in order, two lists at a time. Students watch eight numbers merge level by level, see why it takes about n log₂ n steps and merge two sorted lists by hand.

The slides, one by one

1 Merge sort

Divide, sort, merge

How do you sort a million names quickly?

2 Split into halves, then merge in order

Single items are already sorted

Pairs, then fours, then all eight

3 Merge sort takes about n log₂ n steps

\log_2 n\textsf{ levels, }n\textsf{ steps per level}
\textsf{Far fewer than bubble sort's }n^2

4 Merging two sorted lists

Merge the sorted lists [2, 7, 9] and [1, 8] into one sorted list. Count the comparisons.

→ Compare the two front items and take the smaller each time

1 < 2:\ \text{take } 1
2 < 8:\ \text{take } 2
7 < 8:\ \text{take } 7
9 > 8:\ \text{take } 8
\text{Then } 9:\ [1, 2, 7, 8, 9]

[1, 2, 7, 8, 9] after 4 comparisons

5 Quick check

How many levels of splitting does merge sort need for 16 items?

  • 4
  • 16
  • 8
  • 2
Show the answer

4

16 → 8 → 4 → 2 → 1 is four halvings: log₂ 16 = 4.

6 What to remember

Split until each part has one item

Merge: take the smaller front item

\log_2 n\textsf{ levels of }n\textsf{ steps}
O(n \log n)\textsf{, but needs extra memory}

Challenge: Why does merge sort need extra memory when bubble sort does not?

Every slide is built click by click: text, formulas and pictures come in one step at a time, so the class follows the reasoning instead of reading ahead. Graphs with sliders can be dragged live while you present.

Make your own version with AIChange the level, the numbers or the language: type the topic and get a new deck that moves in about 30 seconds. Free, no account needed.

Questions teachers ask

How does merge sort work?

Split the list in half again and again until each part has one item, then merge neighbouring parts by repeatedly taking the smaller front item. With log₂ n levels of n steps each, it takes about n log₂ n comparisons.

Are these slides really free?

Yes. Watch them on this page or present them full screen with no account. Making your own copy to edit is free too.

Can I change the slides before my lesson?

Yes. Press "Make my own copy" and the deck becomes one of your projects in the Tracé editor, where you can change the text, the numbers, the colours or the order of the clicks.

Do they work on a classroom projector or an interactive whiteboard?

Yes. They run in the browser on any laptop, so anything that shows your screen works. Press the right arrow or click to go to the next step.