Académique Documents
Professionnel Documents
Culture Documents
4 Binary Search
Copyright 20022011
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Successful search. Binary search for 33.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Successful search. Binary search for 33.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Successful search. Binary search for 33.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Successful search. Binary search for 33.
lo = hi
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
mid return 4
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Unsuccessful search. Binary search for 34.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Unsuccessful search. Binary search for 34.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Unsuccessful search. Binary search for 34.
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
lo
mid
hi
Binary search Goal. Given a sorted array and a key, find index of the key in the array? Unsuccessful search. Binary search for 34.
lo = hi
6
0
13
1
14
2
25
3
33
4
43
5
51
6
53
7
64
8
72
9
84
10
93
11
95
12
96
13
97
14
mid return -1