Recall & Review
beginner
What is a peak element in an array?
A peak element is an element that is greater than its neighbors. For the first or last element, only one neighbor is considered.
Click to reveal answer
beginner
Why use binary search to find a peak element?
Binary search reduces the search space by half each time, making the search efficient (O(log n)) compared to checking every element (O(n)).
Click to reveal answer
intermediate
In the binary search for a peak element, if the middle element is less than its right neighbor, where do we search next?
We search in the right half because a peak must exist there.
Click to reveal answer
beginner
What is the time complexity of finding a peak element using binary search?
The time complexity is O(log n) because the search space is halved in each step.
Click to reveal answer
intermediate
Explain the base case when using binary search to find a peak element.
When the search space reduces to one element, that element is a peak because it is greater than its neighbors or it is at the boundary.
Click to reveal answer
What defines a peak element in an array?
✗ Incorrect
A peak element is greater than its neighbors.
If middle element is less than its right neighbor, where should binary search continue?
✗ Incorrect
The peak must be in the right half if middle is less than right neighbor.
What is the time complexity of binary search for peak element?
✗ Incorrect
Binary search halves the search space each step, so O(log n).
Can the first or last element be a peak element?
✗ Incorrect
First or last element can be peak if greater than their single neighbor.
What happens when binary search narrows down to one element?
✗ Incorrect
One element left means it is a peak by definition.
Describe the steps to find a peak element using binary search.
Think about how binary search halves the array each time.
You got /5 concepts.
Explain why binary search guarantees finding a peak element in an array.
Consider the property of elements compared to neighbors.
You got /5 concepts.