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.

If you need to get back to the work on binary search you can find it here.

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.

A second linear search program

There's a second linear search program to try:

> Second linear search programming instructions

Using Python online

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

> Code today coding

> Online Python coding

Flags with the Python turtle