Recall & Review
beginner
What is the main difference between Binary Search and Linear Search in terms of data requirements?
Binary Search requires the data to be sorted, while Linear Search works on both sorted and unsorted data.
Click to reveal answer
beginner
How does the time complexity of Linear Search compare to Binary Search?
Linear Search has a time complexity of O(n), meaning it may check every element. Binary Search has a time complexity of O(log n), cutting the search space in half each step.
Click to reveal answer
intermediate
Why might Linear Search sometimes be faster than Binary Search in practice?
For very small or unsorted data sets, Linear Search can be faster because it has less overhead and no need to sort data first.
Click to reveal answer
intermediate
What is the real cost difference when using Binary Search on a sorted array versus Linear Search on the same array?
Binary Search reduces the number of comparisons drastically, especially for large arrays, making it much faster than Linear Search which checks elements one by one.
Click to reveal answer
beginner
In what scenario is Linear Search preferred over Binary Search despite its higher time complexity?
When the data is unsorted or very small, Linear Search is preferred because it does not require sorting and has simpler implementation.
Click to reveal answer
Which search algorithm requires sorted data to work correctly?
✗ Incorrect
Binary Search only works correctly on sorted data because it divides the search space based on order.
What is the worst-case time complexity of Linear Search?
✗ Incorrect
Linear Search may need to check every element, so its worst-case time complexity is O(n).
How does Binary Search reduce the search space each step?
✗ Incorrect
Binary Search halves the search space each step by comparing the middle element.
When might Linear Search be faster than Binary Search?
✗ Incorrect
For small or unsorted data, Linear Search can be faster due to less overhead.
Which search algorithm has a time complexity of O(log n)?
✗ Incorrect
Binary Search has O(log n) time complexity because it halves the search space each step.
Explain the real cost difference between Binary Search and Linear Search when searching in a large sorted array.
Think about how many elements each algorithm checks.
You got /6 concepts.
Describe scenarios where Linear Search might be preferred over Binary Search despite its higher time complexity.
Consider data size and sorting requirements.
You got /5 concepts.