At top is the statement “key is 63”. Below, three columns of ten adjacent boxes are shown, each labeled from a[0] to a[9] from top to bottom. The numbers within these respective boxes are as follows: 15, 20, 35, 41, 57, 63, 75, 80, 85, 90.
In the first column of boxes, a[0] (15) is labeled “first == 0”; a[4] (57) is labeled “mid = (0 + 9)/2”; and a[9] (90) is labeled “last == 9”.
In the next column of boxes, at right, a[0] through a[4] are labeled “Not in this half”; a[5] (63) is labeled “first == 5”; a[7] (80) is labeled “mid = (5 + 9)/2”; and a[9] (90) is labeled “last == 9”.
In the next column pf boxes, at lower left, a[5] (63) is labeled “first == 5”; a[6] (75) is labeled “last == 6”; and a[7] through a[9] are labeled “Not here”.
A block of code at lower right reads as follows:
mid = (5 + 6)/2 which is 5
a[mid] is a[5] == 63
found = true;
location = mid;