Showing AQAChange board

Deep Dive: Worked Example

Test yourself on Binary Search with exam style questions, marked instantly.

Flashcards that come back just before you would forget them.

A revision plan that remembers what you know and shows what to do next.

See which topics you have nailed and which need another look.

Quiz yourself on Binary SearchGet your flashcardsBuild my revision planTrack my progress

Deep Dive: Worked Example

Find 23 in [2, 5, 8, 12, 16, 23, 38] (positions 0 to 6):

StepLowHighMidpointMiddle itemDecision
10631223 is bigger, keep the right half
246523Equal: found at position 5

Only two items were checked. A linear search would have checked six.

Searching for 10 in the same list: low 0, high 6, mid 3 (12) so high becomes 2. Mid 1 (5) so low becomes 2. Mid 2 (8) so low becomes 3. Now low (3) is greater than high (2), so 10 is not found.

Make this stick

Signing in gives access to all PrepWise features.

PrepWise is a trading name of A3M Quality Solutions Limited, registered in England and Wales, company number 14959172. Registered office: 202 Stroud Road, Gloucester, GL1 5LA. ICO registration ZC267069.