Flag question
j:= n {/ is right endpoint of search interval}
while / </:
i+j
2
if xam then i := m + 1
else j := m
if x = a; then location := i
else location := 0
return location{location is the subscript i of the term ai equal to x, or 0 if x is not found}
How many comparisons that are used if we use this algorithm to search for x=3 in the list [1, 3, 4, 5, 6, 8, 9, 12, 17, 20, 26]?
A. 8
B. 10
C. 6
D. 9
The correct answer is:10
Question 40
Complete
Mark 1.00 out of 1,00
"Everyone in this discrete mathematics class has taken a course in computer science" and "Marla is a student in this class".
Which conclusion can be drawn?
a. Therefore, Marla did not study discrete mathematics.