Multiple Choice
Which of the following statements about the binary search of an array in ascending order is false?
A) In the worst-case scenario, searching a sorted array of 1023 elements takes only 10 comparisons when using a xe "binary search:algorithm"bxe "efficiency of:binary search"inary search. The number 1023 (which is 210 - 1) is divided by 2 only 10 times to get the value 0, which indicates that there are no more elements to test.
B) Dividing by 2 is equivalent to one comparison in the binary search algorithm. Thus, an array of 1,048,575 (220 - 1) elements takes a maximum of 20 comparisons to find the key, and an array of about one billion elements takes a maximum of 30 comparisons to find the key. This is a tremendous performance improvement over the xe "linear search algorithm"linear search.
C) For a one-billion-element array, the increase in performance of a binary search over a linear search is a difference between an average of five million comparisons for the linear search and a maximum of only 30 comparisons for the binary search!
D) The binary search's big O is xe "Big O notation"O(log n) , which also is known as logarithmic run time and pronounced as "order log n." Of course, this assumes the array is sorted, though, which could take substantial time.
Correct Answer:

Verified
Correct Answer:
Verified
Q3: The following fibonacci function calculates the nth
Q4: Which of the following statements a), b)
Q5: Which of the following statements a), b)
Q6: Which of the following statements a), b)
Q7: An algorithm that tests whether the first
Q9: Which of the following statements about binary
Q10: Suppose an algorithm is designed to test
Q11: Suppose you have an algorithm that tests
Q12: The following code implements a simple linear
Q13: Which of the following statements a), b)