Searching Algorithms

What is Searching?

In Computing, the word search means finding a particular value in a list of sorted values. It is a technique similar to searching for an answer using the trial and improvement method of solving an equation for GCSE Maths. 

Searching and sorting should really be considered together.  These search algorithms only work on sorted data, and time spent sorting your data will save time when searching.  This how much easier it is to find a book or a CD on your shelf if they are in order - and how finding a book in a library would be nearly impossible if the books weren't sorted.

Investigate

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.

Guesses

Search

Questions

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.