Search Algorithms
1. Nicola has a list of numbers: 2,3,7,5,13,11
She says, “I can’t use a binary search to find 13.” Why is this the case? [1]
2. Show the steps of a linear search to find 13 in the list above? [2]
3. Sonia has a sorted list of ice cream flavours she sells in a shop.
a) Show the stages of a binary search to find the word ‘butterscotch’ in the list below:
Butterscotch Chocolate Mint Strawberry Vanilla
[4]
b) Give one advantage of using a binary search over the linear search. [1]
c) Six more flavours are added to Sonia’s list. The list is still in alphabetical order. Explain
why it would only take two iterations of a binary search to find the ninth item in the list.
[3]
4. Here is a list of the ages of Maya’s sons and daughters:
3 6 8 11 13 15 18
a) Use a binary search to find ‘8’ in the list.
b) Use a linear search to find ‘11’ in the list.
4. What are the benefits and drawbacks for using a linear search over a binary search?
5. Here’s a fascinating list of British towns and cities:
Ashington Brecon Chestor Dagenham Morpeth Usk Watford
a) Use a binary search to find “Morpeth” in the list above.
b) Use a linear search for the same as above.