﻿ Searching Algorithms | Interactive | Computing ﻿

# Searching Algorithms

The word search doesn't mean quite the same thing in Computing as it did in ICT. Rather than searching a database, or the world-wide web, you are more likely to consider searching through a list of sorted numbers. It is a technique similar to searching for an answer using the trial and improvement method of solving an equation for GCSE Maths.

The KS3 National Curriculum for Computing says that students need to be aware of different types of algorithms.  This page compares the two most common searching algorithms - the linear search and the binary search - to find the whole number that you are thinking of.

### Search

Type of search : Maximum value:

### Questions

• Which of these searches found your number more quickly?

• Does the number you choose make a difference? Could you choose a number that would make the linear search faster than the binary search?

• On average, how many guesses would the linear search make? What is the maximum number of guesses that the binary search needs?

There are examples of linear and binary searches programmed in BASIC and Python. Try changing the program so that it finds a number from 1-1000 - how many guesses does the binary search need then?

There is also a similar page that allows you to compare sorting algorithms.