GateAI
Asymptotic Analysis

GATE CSE 2026 Set 2 · Q38

MCQ2 marksEasy

Time

Consider an array AA of integers of size nn. The indices of AA run from 11 to nn. An algorithm is to be designed to check whether AA satisfies the condition given below. ∀i,j∈{1,…,n−1} such that i>j,(A[i+1]−A[i])>(A[j+1]−A[j])\forall i, j \in \{1, \dots, n - 1\} \text{ such that } i > j, (A[i + 1] - A[i]) > (A[j + 1] - A[j]) Which one of the following gives the worst case time complexity of the fastest algorithm that can be designed for the problem?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) (n)

Asymptotic Analysis

Let D[k]=A[k+1]−A[k]D[k] = A[k + 1] - A[k] for all k∈{1,2,…,n−1}k \in \{1, 2, \dots, n - 1\}.

The given condition requires that for all i>ji > j:

D[i]>D[j]D[i] > D[j]

This is equivalent to stating that the sequence of adjacent differences DD is strictly increasing:

D[1]<D[2]<⋯<D[n−1]D[1] < D[2] < \dots < D[n - 1]

To check this property:

  1. It is both necessary and sufficient to verify that D[k]<D[k+1]D[k] < D[k + 1] for every k∈{1,…,n−2}k \in \{1, \dots, n - 2\}, which is equivalent to (A[k+1]−A[k])<(A[k+2]−A[k+1])(A[k + 1] - A[k]) < (A[k + 2] - A[k + 1]).

  2. We can perform a single linear scan over the array AA from index 11 to n−2n - 2 and check the condition at each step.

  3. This linear scan takes Θ(n)\Theta(n) time in the worst case.

Since any algorithm must inspect Ω(n)\Omega(n) elements of the array in the worst case to verify this condition, the optimal worst-case time complexity is Θ(n)\Theta(n).

Therefore, (A) is the correct option.

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 Asymptotic Analysis previous year question is Q38 of the GATE CSE 2026 Set 2 paper. Find more GATE CSE PYQs on Asymptotic Analysis 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 Asymptotic Analysis 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.

Asymptotic Analysis in GATE CSE

Asymptotic Analysis has 31 GATE CSE PYQs across 19 papers from 2011 to 2026. 12 of them are 2-mark MCQs like this one, and GATE CSE 2026 Set 2 has 3.

How GATE tests Asymptotic Analysis

More from GATE CSE 2026 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2026 Set 2 · Q38 · MCQ

Consider an array A of integers of size n. The indices of A run from 1 to n. An algorithm is to be designed to check whether A satisfies the condition given below. ∀ i, j ∈ {1, , n - 1} such that i > j, (A[i + 1] - A[i]) > (A[j + 1] - A[j]) Which one of the following gives the worst case time complexity of the fastest algorithm that can be designed for the problem?

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.