Binary Search (OCR A-Level Computer Science): Quizzes
📚Quizzes
Practise the questions
12 questions from this quiz
ShowHide
Practise the questions
12 questions from this quiz
What is the essential pre-condition for Binary Search to work correctly?
What is the essential pre-condition for Binary Search to work correctly?
The data must be sorted
What is the worst case time complexity of Binary Search?
What is the worst case time complexity of Binary Search?
What is the best case time complexity of Binary Search?
What is the best case time complexity of Binary Search?
What is the space complexity of the iterative Binary Search implementation?
What is the space complexity of the iterative Binary Search implementation?
If the target is greater than the middle element, which half should be searched?
If the target is greater than the middle element, which half should be searched?
The right half
If the target is smaller than the middle element, which half should be searched?
If the target is smaller than the middle element, which half should be searched?
The left half
What value does Binary Search return when the target is not found?
What value does Binary Search return when the target is not found?
-1
What is the loop condition in iterative Binary Search?
What is the loop condition in iterative Binary Search?
low <= high
How is the middle index calculated in Binary Search?
How is the middle index calculated in Binary Search?
(low + high) DIV 2
How does Binary Search compare to Linear Search for large datasets?
How does Binary Search compare to Linear Search for large datasets?
Binary Search is much faster
Why does applying Binary Search to unsorted data lead to incorrect results?
Why does applying Binary Search to unsorted data lead to incorrect results?
Binary Search only works on sorted data
What is the base condition for the recursive Binary Search implementation?
What is the base condition for the recursive Binary Search implementation?
IF low > high
