Join 36000+ teachers and students using TTIO.
Note: Step by step coded tutorials provided in Binary and Linear Search
An algorithm is a sequence of instructions or a set of rules to get something done.
You probably know the fastest route from school to home, for example, turn left, drive for five miles, turn right. You can think of this as an ‘algorithm’ – as a sequence of instructions to get you to your chosen destination. There are plenty of algorithms (i.e. routes) that will accomplish the same goal; in this case, there are even algorithms (such as in your satnav) for working out the shortest or fastest route.
Algorithms are written for a human, rather than for a computer to understand. In this way algorithms differ from programs.
We spend much of our life searching for stuff. Searching is important and we need to know how to get computers to do it efficiently. In this section we'll be looking at two different types of search.
We often need to find one particular item of data amongst many hundreds, thousands, millions or more. For example, you might need to find someone’s phone number on your phone, or a particular business’s address in the UK.
This is why searching algorithms are important. Without them you would have to look at each item of data – each phone number or business address – individually, to see whether it is what you are looking for. In a large set of data, it will take a long time to do this. Instead, a searching algorithm can be used to help find the item of data you are looking for.
Searching Algorithms :