Printable worksheet ยท 4 of 4

Halving needs ordered data - Paper 4

Read the information, then answer the questions. An adult may read the instructions aloud. Show your working where asked.

Read before answering

Sorted list [9,11,13,15,17,19,21]; target 22. Binary search starts low=0, high=6. While low <= high, use mid = floor((low+high)/2); compare with target; stop on equality. If middle is smaller, set low=mid+1; otherwise high=mid-1. Stop absent when low>high. Indices start at zero.

Worksheet preview

This exercise is included in the paid course. Full-course fee: GBP 200.00 once. Register and enrol to complete all course exercises and download the course PDFs. Access begins after payment is confirmed.

Register and enrol

Already registered? Sign in