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 A?
Correct : d
The correct answer is Option D — Θ(log n).
A bitonic array increases up to a peak element and then decreases. To search for a target element efficiently, the algorithm runs in three steps — all using binary search:
Step 1 — Find the peak: Use binary search to locate the index i where the maximum element sits. This takes O(log n).
Step 2 — Binary search on ascending half: Search for the target in A[1..i] (sorted in non-decreasing order) using standard binary search — O(log n).
Step 3 — Binary search on descending half: If not found, search in A[i+1..n] (sorted in non-increasing order) using a modified binary search — O(log n).
The three steps together still give Θ(log n) in the worst case since constants are absorbed in asymptotic notation.
Option A — Θ(n): This would be a linear scan — correct but not the best possible. Incorrect.
Option B — Θ(1): Constant time search in an unsorted/partially sorted array is impossible. Incorrect.
Option C — Θ(log2n): Asymptotically, log2n and log n are identical (differ only by a constant factor). The question distinguishes C and D to test whether the student knows that specifying base 2 is redundant in asymptotic notation — D with the cleaner Θ(log n) is the intended correct form.
Similar Questions
Total Unique Visitors