- Search Algorithms
- Linear Search
- Linear Demo
- Binary Search
- Binary Search Demo
- Activity 1
- Activity 2
- Searching Game? how quick to find the letter using scratch
- How quick to find the word using trinket
- Board version – 20 questions
- Higher or lower game?
What are search algorithms and why do we need them?
Often on your smart phone you might search for:
- a contact in order to call me
- a business or group on social media
- a location on a map
Computers store a massive amount of information, and it would be impractical (if not impossible) to look for all the data we need manually. This means that computers need to be able to search through information to find it. What method the computer uses is known as the search algorithm.
A linear search algorithm is an algorithm that starts at the beginning of a list and goes through each item in the list, looking for a match.
- Very simple
- Can be using on sorted or unsorted lists
- Very slow
Linear Demo Video Here
A binary search algorithm is an algorithm that starts in the centre of a list and finds out of the value is greater or less than the value at the mid point (or if it is the value!)
The unused part of the list it then discarded and the process begins all over again.
- Very Fast, even with massive data sets
- Can only be used with sorted lists
Activity 1 – Search practice
Activity 2 – Learning Log