NEW
Font size
Worksheets2.1.3 Searching Algorithms
Total questions: 12
Worksheet time: 10mins
In which of the following cases, binary search algorithm is used?
To search an element in an unordered list.
To search an element in a list of few elements.
To search an element in any ordered list with large number of elements.
An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?
32
16
8
5
Complete the sentence: The lower half of the list is discarded if the value at midpoint is …………………….. item searched.
less than
greater than
equal to
True or False: The upper half of the list is discarded if the value at midpoint is greater than item searched.
True
False
What is the disadvantage of binary search algorithm?
It takes longer time when compared to linear search algorithm
It works only on sorted lists
It is very complex to understand
How is the midpoint of the list calculated?
midpoint= int ((first_element+last_element)/2)
midpoint=(lower_bound+upper_bound)/2
midpoint= int ((lower_bound+upper_bound)/2)
midpoint= int ((lower_bound+upper_bound))
