Which of the following is not true of binary search? A : Doubling the size of th
ID: 3737973 • Letter: W
Question
Which of the following is not true of binary search?
A : Doubling the size of the input only increases the number of steps required by 1.
B : Each iteration of binary search rules out roughly half the array.
C : It is possible for binary search to terminate after the first comparison.
D : Binary search works equally well on sorted and unsorted arrays.
E : The worst case performance of binary search is logarithmic in the size of the input.
F: If the input array is large enough, binary search will be faster than linear search even if every operation in the linear search runs 100 times as fast as every operation in the binary search.
Explanation / Answer
D) is no a True statement.
Bubble sort main requirement is it need a sorted list to search a key value from list.
What it does is it calculate the median of the sorted list and compair it with the given key value
and,
if key==median
you got the key in list
if key<median
set new_upper_limit to index_of_median-1
set new_lower_limit to previous_lower_limit
binary_search(new_upper_limit,new_lower_limit,key)
if key>median
set new_lower_limit to index_of_median-1
set new_upper_limit to previous_upper_limit
binary_search(new_upper_limit,new_lower_limit,key)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.