That Blue Square Thing

Do now tasks slidePDF icon

Knowledge organiserPDF icon

Year 9 Computing – Algorithms, puzzles and programming

Search algorithms

The search algorithm you used last week is called a binary search algorithm.

It is a really important algorithm to know about.

The key learning slides will teach you more about it.

PDF iconKey learning slides

Then you have some written work to do.

If you need them, here are the programming instructions.

> programming instructions

There are some ways you can extend this idea a bit further as well.

PDF iconExtending the program

A different algorithm

There's another way to find a number. This uses a linear search algorithm which is simpler to use.

PDF iconLinear search algorithm key learning slides

We can code this as well. But, even better, we can code it so that the computer does the guessing.

Here's some Scratch code to implement this:

PDF iconThe Scratch program

And here are instructions for how to do this in Python.

> linear search programming instructions

This program will work like a robot and should guess any number using a linear search.

Binary search maths

Binary search is based on some interesting maths. It's complex, but you can take a look at the idea here:

Here's the theory:

PDF iconHow many guesses?

Using Python online

There's a way to use Python online if it doesn't work on your computer:

> Online Python coding