Fill in the following table, showing the number of comparisons needed either to
ID: 3548608 • Letter: F
Question
Fill in the following table, showing the number of comparisons needed either to find the value or to determine that the value is not in the array, given the following array of values.
dataValues
14
27
95
12
26
5
33
15
9
99
[0]
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
Values
Search dataValues
Sequentially
Search sortedValues Sequentially
Binary Search sortedValues
Search
Tree
15
17
14
5
99
100
0
14
27
95
12
26
5
33
15
9
99
[0]
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
Explanation / Answer
Array Elements:
14
27
95
12
26
5
33
15
9
99
Sorted Elements:
5
9
12
14
15
26
27
33
95
99
Values
Search dataValues
Sequentially
Search sortedValues Sequentially
Binary Search sortedValues
Search
Tree
15
8
5
3
15, 9, 5
17
10
6
3
15, 33, 26
14
1
4
4
15, 9, 12, 14
5
6
1
3
15, 9, 5
99
10
10
4
15, 33, 95, 99
100
10
10
4
15, 33, 95, 99
0
10
1
3
15, 9, 5
While searching in the sorted array, we will stop searching as soon as we encounter an element greater than the search key element. For example, while seaching for 17 in the sorted array, we stop searching when we encounter 26 in the list of elements.
14
27
95
12
26
5
33
15
9
99
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.