Consider an array 𝐴 of integers of size 𝑛. The indices of 𝐴 run from 1 to…

PYQ GATE 2026

Consider an array 𝐴 of integers of size 𝑛. The indices of 𝐴 run from 1 to 𝑛. An algorithm is to be designed to check whether 𝐴 satisfies the condition given below
βˆ€π‘–,𝑗 ∈ {1, … , 𝑛 βˆ’ 1} such that 𝑖 > 𝑗, (𝐴[𝑖 + 1] βˆ’ 𝐴[𝑖]) > (𝐴[𝑗 + 1] βˆ’ 𝐴[𝑗])
Which one of the following gives the worst case time complexity of the fastest algorithm that can be designed for the problem?

  1. A.

    Θ(n)

  2. B.

    Θ(log⁑n)

  3. C.

    Θ(nlog⁑n)

  4. D.

    Θ(n2)

Attempted by 301 students.

Sign up free to check your answer

Sign up free

Explore the full course: Algorithms

Loading lesson…