First make both methods answer the same question
A checkpoint system stores the codes [14, 5, 9, 3, 12]. A request asks whether a particular code is present. We will compare two correct ways to answer that membership question, then consider which does less work in a stated situation. Membership means present or absent; it does not ask for the code's original position.
Linear search can inspect the original list from the left. Binary search needs the list in order, so its version uses [3, 5, 9, 12, 14]. Both must report that 14 is present and 8 is absent. A quick answer that misses a valid item is not an improvement.
Sorting changes positions: 14 is at index 0 in the original list but index 4 in the sorted list. If the actual task asks for the original position, preserve that information with each item. Do not compare methods that silently answer different questions.
Define what the count measures
For a search, count one inspection each time the algorithm reads a list value and checks it against the target. Count an inspected value even when it is not a match. A final check that the search range is empty does not inspect another list value.
For sorting, count one value comparison whenever two item values are compared. Do not add swaps, shifts or copies to that comparison total: those are different actions. The table below counts processing work using these explicit rules; it is not a stopwatch result.
The given binary search uses inclusive lower and upper positions and rounds the midpoint down. The given bubble sort reduces the active end after each pass and stops after a complete pass with no swaps. A different supplied version can produce different counts, so use the exact convention in the question.
Follow both search routes before comparing their totals
Start with target 14. Linear search sees 14 immediately: one inspection. Binary search on the ordered list sees 9, then 12, then 14: three inspections. For this request, being able to halve a range did not give the smaller count.
Now reset both searches and request 9. Linear search inspects 14, 5 and 9. Binary search inspects the middle value 9 immediately. This time the counts are three and one. The target's position matters, so do not pick just one favourable request and call a method always fastest.
The worked request set is 14, 12, 9, 5, 3, in that order. Reset the search bounds or starting index for every request. Here are all five routes, not only their final totals.
| Target | Linear: values inspected | Linear count | Binary: values inspected | Binary count |
|---|---|---|---|---|
| 14 | 14 | 1 | 9, 12, 14 | 3 |
| 12 | 14, 5, 9, 3, 12 | 5 | 9, 12 | 2 |
| 9 | 14, 5, 9 | 3 | 9 | 1 |
| 5 | 14, 5 | 2 | 9, 3, 5 | 3 |
| 3 | 14, 5, 9, 3 | 4 | 9, 3 | 2 |
Include work done before the first search
The original list is not ordered. Our two routes are therefore 'search the original list linearly' and 'sort once, then search the ordered list with binary search'. Applying binary search directly to the original unordered list is not a third valid shortcut.
For this worked preparation, the stated bubble sort makes 10 value comparisons. The five linear searches make 15 inspections. The five binary searches make 11 inspections, but preparing their ordered input adds 10: the combined count is 21, not 11.
Under this simplified counting rule, one request set therefore favours the linear route: 15 rather than 21. This combines sorting comparisons and search inspections as counted work, not as operations guaranteed to take equal time. It supports a qualified processing comparison, not an exact speed ratio.
| Route for one set | Preparation comparisons | Search inspections | Combined counted work |
|---|---|---|---|
| Linear on original list | 0 | 15 | 15 |
| Sort once, then binary | 10 | 11 | 21 |
Continue with your exam board
The course combines lesson videos, interactive activities, topic questions and original exam mocks. Sign in to use the learning tools and save your progress; your account’s course access applies.
Independent learning resources. Not endorsed by AQA or OCR. These public introductions complement the full course and the official specification.