An automated weather monitoring network stores active telemetry node data in a database. The database contains a sorted array of sensor IDs:
| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| Sensor ID | 104 | 112 | 118 | 125 | 131 | 145 | 150 |
State the values that would be compared, in order, if a binary search algorithm was used to search for the sensor ID 118 in this array.
Note: The midpoint index at each step is calculated using integer division: midpoint=⌊(lower+upper)/2⌋\text{midpoint} = \lfloor(\text{lower} + \text{upper}) / 2\rfloormidpoint=⌊(lower+upper)/2⌋.
33 exam-style questions on AQA GCSE Computer Science Searching algorithms. Each one has a worked solution and a mark scheme showing where the marks go.