Skip to main content

GATE CSE 2021Algorithms › Growth of Functions & Complexity AnalysisVerified

GATE CSE 2021 PYQ: Consider the following recurrence relation. T ( n ) = { T ( n / 2 ) + T ( 2 n / 5 ) + 7 n if n > 0 1 if n =…

Consider the following recurrence relation.

T(n)={T(n/2)+T(2n/5)+7nif n>01if n=0T(n) = \begin{cases} T(n/2) + T(2n/5) + 7n & \text{if } n > 0 \\ 1 & \text{if } n = 0 \end{cases}

Which one of the following options is correct?

  1. A
    T(n)=Θ(n5/2)T(n)=\Theta (n^{5/2})
  2. B
    T(n)=Θ(nlog⁡n)T(n)=\Theta (n\log n)
  3. C
    T(n)=Θ(n)T(n)=\Theta (n)
    Correct answer
  4. D
    T(n)=Θ((log⁡n)5/2)T(n)=\Theta ((\log n)^{5/2})

Answer

(C) T ( n ) = Θ ( n ) T(n)=\Theta (n) T ( n ) = Θ ( n )

Approach

Use the recursion-tree method. At every fully active level, the sum of subproblem sizes is multiplied by 1/2 + 2/5 = 9/10 < 1, so the non-recursive work 7n forms a decreasing geometric series. The root work dominates, giving Θ(n).

The recurrence has two recursive calls of sizes n/2 and 2n/5, whose fractions sum to 9/10 < 1. Therefore the work per level decreases geometrically, and the total work is dominated by the root level, giving T(n) = Θ(n).

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.