Skip to content
ExamSpine

Answer it

P2 b2 library search compare

4 marksYou mark it yourself against the marking points

A school library keeps the IDs of its 1000 books in a list (an array in Java), and a librarian looks up one ID at a time.

(a) Explain why a binary search only works if the IDs are sorted. [2]

(b) State the largest number of IDs a linear search would have to look at to find one ID, and the largest number a binary search would have to look at, for the 1000 books. [2]

[4]