GateAI
Searching, Sorting and Hashing

GATE CSE 2025 Set 2 · Q41

MCQ2 marksMedium

Time

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 \dots i] is sorted in the non-decreasing order and A[i+1…n]A[i + 1 \dots 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?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) (log n)

Searching, Sorting and Hashing

To search for a target element in a bitonic array of size nn:

  1. Find the peak (maximum element) index ii: Using a modified binary search, compare the middle element with its neighbors to determine whether the peak lies to the left or to the right. This takes O(log⁡n)O(\log n) comparisons.

  2. Search the two monotonic halves:

    • Perform standard binary search on the increasing subarray A[1…i]A[1 \dots i], which takes O(log⁡n)O(\log n) comparisons.

    • Perform descending binary search on the decreasing subarray A[i+1…n]A[i+1 \dots n], which takes O(log⁡n)O(\log n) comparisons.

The total worst-case number of comparisons is:

T(n)=O(log⁡n)+O(log⁡n)+O(log⁡n)=Θ(log⁡n)T(n) = O(\log n) + O(\log n) + O(\log n) = \Theta(\log n)

Since searching in an array of nn elements has an information-theoretic lower bound of Ω(log⁡n)\Omega(\log n) comparisons, Θ(log⁡n)\Theta(\log n) is the optimal asymptotic bound.

Therefore, option D is correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Searching, Sorting and Hashing previous year question is Q41 of the GATE CSE 2025 Set 2 paper. Find more GATE CSE PYQs on Searching, Sorting and Hashing in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Searching, Sorting and Hashing PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Searching, Sorting and Hashing in GATE CSE

Searching, Sorting and Hashing has 27 GATE CSE PYQs across 20 papers from 2012 to 2026. 7 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2025 Set 2.

How GATE tests Searching, Sorting and Hashing

More from GATE CSE 2025 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 2 · Q41 · MCQ

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

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.