Skip to content
GATEiit

GATE CSE 2025 Session 2 Q41: Comparisons needed to search a bitonic array

Question

An array AA of length nn with distinct elements is said to be bitonic if there is an index 1≤i≤n1 \le i \le n such that A[1..i]A[1..i] is sorted in the non-decreasing order and A[i+1..n]A[i+1..n] 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 AA?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: D (official GATE 2025 final answer key)

Concept used: Binary search for the peak, then binary search in each monotone half.

First step: Compare A[m]A[m] with A[m+1]A[m+1] to tell which side of the peak mm is on, and find the peak in O(log⁡n)O(\log n) comparisons.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key