0% found this document useful (0 votes)
6 views1 page

Search Algorithms Questions

The document discusses search algorithms, specifically linear and binary search methods. It includes examples of searching for numbers and words in lists, explaining the processes and advantages of each method. Additionally, it highlights the efficiency of binary search in sorted lists and the implications of adding items to such lists.

Uploaded by

arushi.m.malik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Search Algorithms Questions

The document discusses search algorithms, specifically linear and binary search methods. It includes examples of searching for numbers and words in lists, explaining the processes and advantages of each method. Additionally, it highlights the efficiency of binary search in sorted lists and the implications of adding items to such lists.

Uploaded by

arushi.m.malik
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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.

You might also like