Question
An array of length with distinct elements is said to be bitonic if there is an index such that is sorted in the non-decreasing order and is sorted in the non-increasing order.
Which ONE of the following represents the best possible asymptotic bound for the worst-case number of comparisons by an algorithm that searches for an element in a bitonic array ?
Official answer and solution
- Official answer
- D
- From
- Official GATE 2025 answer key
Solution
Find the bitonic peak index in comparisons via binary search, then binary-search both monotonic halves in comparisons.
- Upper bound : Using binary search on adjacent elements ( vs. ), we can locate the peak index of the bitonic array in comparisons. Once is known, is strictly increasing and is strictly decreasing, so two standard binary searches take comparisons.
- Lower bound : Any sorted array is a special case of a bitonic array (with ), and searching a sorted array of distinct elements requires comparisons in the worst case.
Thus the best possible worst-case bound is .
Option (D)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 41 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.