Wednesday 11 October 2017

Algorithms lesson 3 - searching

In this lesson you are going to find out about the two types of computer searching.

Your lesson objectives and outcomes are:

Explain what a search algorithm is and how serial and binary search algorithms work.
Apply your understanding by giving an example of how each search algorithm works for a set of numbers
Link your examples to previous work by drawing them out as two separate flow charts, showing the search procedure.

There are 2 types of computer searching: serial and binary.

Serial searching
This is where each item is checked in turn, eg trying to find a needle in a haystack where each clump of hay is picked up in sequence and checked underneath for a needle.

Binary searching
Here the items have to be in order so that, if searching for a name in a list in alphabetical order, the computer selects one at random and then compares it with the alphabet as to whether it needs to search to the left or right and eliminates those letters that are above it, eg searching for Fred and randomly chooses 'G'.  Letters to the right (H onwards) are dismissed and it checks at random another to the left and continues the search as  before.

Your tasks

1.  In detail, explain how a serial search would work in searching for a ball under 5 cups.


2.  In detail, explain how binary search would be used to search for the number 25 in the sequence below...

2   8   9   11  17   19   21   25   31   34   45   57   59   62   66   71

3.  For a binary search to work, what has to be correct with the data?

4.  Go to the Bitesize link below, read through the information and then have a go at the test.  Write down your test score on your blog under your written work for tasks 1 -3.
Link to Bitesize info and test



No comments:

Post a Comment