GATE CS 2000 · Asymptotic Analysis & Recurrences

MCQ · 1 mark · Problem PROG-DIVC-0160

Let S be a sorted array of n integers. Let T(n) denote the time taken for the most efficient algorithm to determined if there are two elements with sum less than 1000 in S. Which of the following statement is true?
  1. A
    \(T (n) \text{ is }O(1)\)
  2. B
    \(n \leq T(n) \leq n \log_2 n\)
  3. C
    \(n \log_2 n \leq T(n) \lt \frac{n}{2}\)
  4. D
    \(T(n) = \left (\frac{n}{2} \right)\)

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option A.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/638/gate2000-1-15

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com