ISRO 2018 · Asymptotic Analysis & Recurrences

MCQ · 1 mark · Problem PROG-DIVC-0089

The running time of an algorithm is given by:\[T(n)=\left\{\begin{matrix} T(n-1)+T(n-2)-T(n-3), &\text { if } n>3\\ n, &\text{ otherwise}\end{matrix}\right.\]Then what should be the relation between \(T(1),T(2),T(3)\), so that the order of the algorithm is constant?
  1. A
    T(1) = T(2) = T(3)
  2. B
    T(1) + T(3) = 2T(2)
  3. C
    T(1) - T(3) = T(2)
  4. D
    T(1) + T(2) = T(3)

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/213551/isro2018-37

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