9_1_5

WHAT: Understand the concept of linear and binary searches

HOW:

Activity 1 - READ and WATCH

You had a brief introduction to linear and binary searches in 7_2_8.

They are specific algorithms to search for items of data.

Watch the two videos again to remind you:

A linear search looks at each item of data from the start of the list and checks if it is the required item. It will keep doing this until it has found the item or it reaches the end of the list.

A binary search works like this:

  • Put the data into order (alphabetical or numerical etc.)

While the search term isn't found it will:

    • Find the mid point
    • Check if the search term is at the mid point
    • The data will then split
    • If the search term is higher than the mid point then it will move to that half
    • If it is lower it will move to that half

Activity 2

Carry out the two different search types using some numbers on a piece of paper that have been cut up.

You can use this document if you want to.

CHECK:

EMBED:

Create an animation to show how a linear and binary search work.

CLASSROOM IDEAS:

This is better as a practical activity to get students to understand the process. They should spend some time of Activity 2 until they really understand what is going on.

They could also look at coding a linear search to see if they can do it!