Analysis of Probe
Find a number in the range 1 to 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Probe = 10, [1,20] (1+20)/2 = 10.5 (1+20)\2 = 10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Probe = 15, [11,20] (11+20)/2 = 15.5 (11+20)\2 = 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Probe = 13, [11,15] (11+15)/2 = 13 (11+15)\2 = 13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Probe = 14, [14,15] (14+15)/2 = 14.5 (14+15)\2 = 14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Probe is found by adding end points and dividing by 2
Integer divide (\) drops fractional digits, giving the right probe value