Searching Algorithms — Concept Check
Questions on Searching Algorithms. Binary search is not just for sorted arrays — master the template that solves dozens of "find the answer" problems.
Questions in this quiz
7 questions on Searching Algorithms — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a sorted array of 1,000,000 numbers. What is the time complexity of finding a specific number using binary search?
- AO(n log n)
- BO(n)
- CO(log n)
- DO(1)
2.A server can handle up to 10,000 requests per second. You want to determine the maximum number of users it can support simultaneously without exceeding this limit. Which algorithmic approach would you use?
- ABinary search on the answer
- BExponential search
- CDepth-first search
- DLinear search
3.You're tasked with finding the smallest capacity of a container that can hold a given set of items. Which search method would efficiently solve this problem?
- ABreadth-first search
- BLinear search
- CBinary search on the answer
- DTernary search
4.A sorted 2D matrix has dimensions m x n. What is the time complexity of searching for an element using binary search?
- AO(log(m*n))
- BO(m + n)
- CO(m*n)
- DO(log m + log n)
5.In a game, you need to guess a secret number between 1 and 1000. What strategy minimizes the number of guesses?
- ABinary search
- BLinear search
- CRandom guessing
- DExponential search
6.A developer claims that binary search can be used on any dataset, sorted or unsorted. What is the flaw in this statement?
- ABinary search requires a sorted dataset
- BBinary search is slower than linear search
- CBinary search works on unsorted datasets
- DBinary search requires exponential time
7.You need to find the maximum feasible load a system can handle. Which technique is most appropriate for this task?
- ALinear search
- BTernary search
- CRandom search
- DBinary search on the answer