Use the following presorted array to answer the next two que
Use the following pre-sorted array to answer the next two questions:
What values are examined in what order when searching for 99 using binary search
 What value is examined the first time when searching for 99 using binary search?
1
22
65
99
| 1 | 3 | 4 | 7 | 14 | 19 | 22 | 31 | 51 | 65 | 77 | 85 | 99 | 
Solution
first mid index =( 0 + n-1) /2= 13-1/2=6
 First mid element = arr[6]=22
 Hence 22 is the first element accessed.
99 > 22 so go to second half
Next mid index= (6 + 13-1)/2=9
 Mid element =arr[9]=65
99 > 65 so go to second half
Next mid index=(9+13-1)/2=10
 Mid element =arr[10]=77
99>77 so go to second half
Mid element index= (10+13-1)/2=11
 Mid element= arr[11]=85
99>85 so go to second half
Mid index = (11+13-1)/2=11.5=12
Mid element =99
 
 Search success using mid element method
 Order of access 22 65 77 85 99

