CIS 15BG
Answers Chapter 8
Arrays: One Dimensional Arrays
1.
A.
Because of its efficiency, binary search is the best search for any array,
regardless of its size and order.
True
/
False
B.
Under what circumstances should we use binary search?
1. The array must be sorted.
2. It is recommended to be used on large arrays, but it could be used on
any sorted array.
2.
Trace the steps of the binary search algorithm to search the following list:
A.
target =
24
12, 14,
19
,
24
,
28
, 30,
35
, 39, 42, 44, 50, 55, 58
0
1
2
3
4
5
6
7
8
9
10
11
12
first
last
first <= last ?
mid
target ? list[mid]
0
12
true
6
24 <
35
0
5
true
2
24 >
19
3
5
true
4
24 <
28
3
3
true
3
24 ==
24
4
3
false
B.
target =
40
12, 14, 19, 24, 28, 30,
35
,
39
,
42
, 44,
50
, 55, 58, 60
0
1
2
3
4
5
6
7
8
9
10
11
12
13
first
last
first <= last ?
mid
target ? list[mid]
0
13
true
6
40 >
35
7
13
true
10
40 <
50
7
9
true
8
40 <
42
7
7
true
7
40 >
39
8
7
false
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentCIS 15BG
Answers Chapter 8
Arrays: One Dimensional Arrays
3.
A.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '10
 Staff
 Binary Search, Computer Programming, Bubble Sort, Insertion Sort, Selection Sort, Comparison sort

Click to edit the document details