1. What condition does ordinary binary search require?
- Sorted data
- Random order
- Unique text values only
Check the answer and reasoning
Sorted data
Ordering lets the search safely discard one half after each comparison.
CS / AS level
Arrays, records, stacks and queues organise values for different operations. Linear search examines candidates in sequence; binary search repeatedly halves a sorted interval.
Arrays, records, stacks and queues organise values for different operations. Linear search examines candidates in sequence; binary search repeatedly halves a sorted interval.
Trace invariants and termination conditions rather than memorising code. A stack is last-in-first-out, while a queue is first-in-first-out; neither rule alone determines a physical implementation.
Push A, then B onto an empty stack; pop once. What is returned?
The most recently pushed item is removed first.
Predict the worked result before calculating. Change one input, record the new result, and explain which assumptions still hold.
Use the prediction activity below; a local model appears only where it supports this topic.
Sorted data
Ordering lets the search safely discard one half after each comparison.
B
The most recently pushed item is removed first.
No
It narrows the candidate interval; linear scanning is a different algorithm.