10 marksSearching and Sorting Algorithms
CAPE Computer Science Unit 2 · 2015 · Paper 2 · Question 2(c)(ii)
An array named numbers of size 50 is loaded with 50 integers sorted in ascending order.
Write code to search for target in the sorted array numbers using binary search. Print its location if found; otherwise print -1.
The mark scheme is shown once you've answered.
Practise this question