Computing
ComputingAlgorithms and programming28 min★★★ difficulty

Sorting and searching

Choosing the right algorithm can be the difference between a million steps and twenty.

Part of your national curriculum
  • Algorithms and programming: Understand several key algorithms, including those for sorting and searching, and use logical reasoning to compare their utility

Lesson overview

What you'll learn in this lesson

Understand several key algorithms, including those for sorting and searching, and use logical reasoning to compare their utility

Key learning points

  • Linear versus binary search
  • Bubble sort
  • Comparing utility

This lesson at a glance

  • 28 minutes
  • 17 parts to scroll through
  • 3 quick checks
  • Marked quiz at the end
  • Gentle pace: short sittings with pauses

Words to know

severalalgorithmssortingsearchinglogical

Scroll down — the lesson carries on below

Part 1 of 17 · Discover6%
1

Watch & discover

Part 1 of 17

Sorting and searching illustrationVisual introduction

Picture this

Sorting and searching

Choosing the right algorithm can be the difference between a million steps and twenty.

In a nutshell

Understand several key algorithms, including those for sorting and searching, and use logical reasoning to compare their utility

2

Learning cycle

Part 2 of 17

Learning cycle 1 of 2

Part 1 · Linear versus binary search

A short piece of teaching, then a check to make sure it has landed.

3

Explore the idea

Part 3 of 17

Learn

Linear versus binary search

Linear search checks each item in turn and works on any list. Binary search repeatedly halves a sorted list, so a million items takes about twenty checks instead of a million.

4

Reset break

Part 4 of 17

Pause

That's sitting 1 of 4 done

Stretch, get a drink, look out of the window. There is no timer and nothing is counting down — your place is saved, so you can come back in five minutes or tomorrow.

Stop here for now
5

Explore the idea

Part 5 of 17

Learn

Bubble sort

Compare neighbouring pairs and swap them if they are the wrong way round, repeating until a full pass makes no swaps. Simple to write, slow on long lists.

6

Quick check

Part 6 of 17

Quick check

Binary search requires the list to be…

7

Quick check

Part 7 of 17

Quick check

Roughly how many checks does binary search need for a million items?

8

Reset break

Part 8 of 17

Pause

That's sitting 2 of 4 done

Stretch, get a drink, look out of the window. There is no timer and nothing is counting down — your place is saved, so you can come back in five minutes or tomorrow.

Stop here for now
9

Learning cycle

Part 9 of 17

Learning cycle 2 of 2

Part 2 · Comparing utility

A short piece of teaching, then a check to make sure it has landed.

10

Explore the idea

Part 10 of 17

Learn

Comparing utility

The best algorithm depends on the situation. Sorting first is only worth it if you will search the list many times.

11

Quick check

Part 11 of 17

Quick check

Bubble sort finishes when…

12

Reset break

Part 12 of 17

Pause

That's sitting 3 of 4 done

Stretch, get a drink, look out of the window. There is no timer and nothing is counting down — your place is saved, so you can come back in five minutes or tomorrow.

Stop here for now
13

Challenge round

Part 13 of 17

Game · Sort it

Which of these are true?

Drag each card into the right column. Tap a card first if dragging is fiddly.

True

Not true

14

Challenge round

Part 14 of 17

Game · Fill the gaps

Finish the sentences

Choose the word that belongs in each gap.

____ first is only worth it if you will search the list many times.

15

Challenge round

Part 15 of 17

Game · Recall cards

Binary search requires the list to be…

Card 1 of 3

16

Mastery quiz

Part 16 of 17

Marked quiz

End of lesson quiz: Sorting and searching

3 questions, marked with the reasoning shown. No timer.

  1. 1. Binary search requires the list to be…

  2. 2. Roughly how many checks does binary search need for a million items?

  3. 3. Bubble sort finishes when…

17

Lesson round-up

Part 17 of 17

Lesson round-up

Ready when you are

Quiz score

Not sat

Games

Not played

Points this lesson

0

Best run

0 in a row

Luna: 0 out of 3 on the practice checks. Only if you feel up to it — one more?

Ask Luna

Part 1 of 17 · Watch & discover

How this is going

  • Not looked at yet

    Understand several key algorithms, including those for sorting and searching, and use logical reasoning to compare their utility

Good Learning Co. — personalised UK curriculum learning, built around what each learner loves.