Java Reference
In-Depth Information
Display 11.7
Execution of the Method search
key is 63
a[0] 15
a[0] 15
first == 0
a[1] 20
a[1] 20
Not in
this half
a[2] 35
a[2] 35
a[3] 41
a[3] 41
a[4] 57
mid = (0 + 9)/2
a[4] 57
first == 5
a[5] 63
a[5] 63
a[6] 75
next
a[6] 75
mid = (5 + 9)/2
a[7] 80
a[7] 80
a[8] 85
a[8] 85
last == 9
last == 9
a[9] 90
a[9] 90
a[0] 15
a[1] 20
a[2] 35
a[3] 41
a[4] 57
mid = (5 + 6)/2 which is 5
a[mid] is a[5] == 63
key
a[5] 63
first == 5
was found.
return 5 .
last == 6
a[6] 75
a[7] 80
Not here
a[8] 85
a[9] 90
 
 
Search WWH ::




Custom Search