# GATE | GATE-CS-2015 (Mock Test) | Question 10

• Last Updated : 28 Jun, 2021

Select the correct asymptotic complexity of an algorithm with runtime T(n, n) where

```T(x, c) = Θ(x) for c <= 2,
T(c, y) = Θ(y) for c <= 2, and
T(x, y) = Θ(x+y) + T(x/2, y/2) ```

(A) Θ(nLogn)
(B) Θ(n2)
(C) Θ(n)
(D) Θ(n2Logn)

Explanation: The recurrence is

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

```T(x, y) = Θ(x+y) + T(x/2, y/2)
```

It can be written as below.

```T(x, y) = Θ(x+y) + Θ((x+y)/2) + Θ((x+y)/4) +  Θ((x+y)/8)  .....
T(x, y) = Θ((x+y) + (x+y)/2 + (x+y)/4 + (x+y)/8  ..... )
```

The above expression forms a geometric series with ratio as 2 and starting element as (x+y)/2

T(x, y) is upper bounded by Θ(x+y) as sum of infinite series is 2(x+y). It is lower bounded by (x+y)

My Personal Notes arrow_drop_up