Which of the following statement(s) is/are true about binary search algorithm?
Which of the following statement(s) is/are true about binary search algorithm?
I. It is implemented on sorted array.
II. One must have direct access to the middle element in any sub-list.
III. It is implemented on sorted linked list.
Show answerHide answer
Correct answer: (C) I and II
Explanation
Binary search needs a sorted list with direct (random) access to the middle element, which an array provides. A linked list has no direct access to the middle, so III is false.