鶹Լ

Comparison of searches

Different might be best used in different situations. For example, sometimes an algorithm won’t work with a particular set of , and in some instances one algorithm will be much quicker or more efficient than another.

Serial search

One of the main advantages of a is that it is a very simple algorithm, which makes it very easy to write a computer to carry it out. It can also be used on any set of data regardless of and whether or not it is .

The biggest problem with a serial search is that it is very slow. For example, when searching through a database of everyone in the UK to find a particular name, it might be necessary to search through 60 million names before you found the one you wanted.

Binary search

One of the main advantages of a is that it is much quicker than a serial search because the data that needs to be searched halves with each step. For example, it is possible to search through 1024 values and find the one you want within 10 steps, every time.

The biggest problem with a binary search is that you can only use this if the data is sorted into an order.