1.0024    Given the sorted array:   12, 21, 29, 34, 35, 37, 42, 48, 50   show in detail the steps which will be used to find the numbers 12, 48, and 39 using a binary search.

 

To find the number 39 (not on the list):

 

 

The middle since (0 + 8)/ 2 = 4

Since 39 is greater than the Middle number, it must be to the right of the list:

 

 

 

The middle since (5 + 8)/2 = 6

Since 39 is less than the Middle number, it must be to the left of the list:

 

 

 

The middle since (5 + 5)/2 = 5

Since 39 is greater than the Middle number, it must be to the right of the list:

 

 

Since the top is now less than the bottom (or the bottom is greater than the top – your choice), the element can not be on the list