(a) State one requirement that the data must meet before a binary search can be used. [1]
(b) Give one advantage of a linear search over a binary search. [1]
(c) A linear search is carried out on an unsorted list of 1000 items. State the maximum number of items that may need to be checked. [1]
- (a) The data must be sorted / in order(1)
- (b) e.g. works on unsorted data / simpler to code / can be quicker for very small lists or when the item is near the start(1)
- (c) 1000(1)
- Answer: (a) Sorted; (b) works on unsorted data; (c) 1000
- Examiner tip: In (b), 'it is faster' doesn't get the mark. Linear search is usually slower, so the advantage you give must be correct.