463 views

3 Answers

1 1 vote

Answer provided is wrong

$$T(n) = 2T(\frac{n}{2})+1$$

when decomposed repeatedly you will get $$T(k) =2^k T(\frac{n}{2^k})+k$$

We know that $\because T(1) =2$

substitute $\dfrac{n}{2^k}=1 \implies n= 2^k \implies \log_2n = k$

$\because$ We are doing asymptotic/polynomial analysis we just consider log, and ignore the bases

$$\boxed{n\times T(1)+\log(n)}$$

 

Take the highest order term:

$$\boxed{\Theta(n)}$$


3rd Option is accurate.
0 0 votes
Step 1: Apply the Master Theorem

 

The recurrence relation is $T(n) = 2T(\frac{n}{2}) + 1$.

This fits the Master Theorem format $T(n) = aT(\frac{n}{b}) + f(n)$ with $a=2$, $b=2$, and $f(n)=1$.

We compare $f(n)$ with $n^{\log_b a} = n^{\log_2 2} = n^1 = n$. Here, $f(n) = 1$, which is $O(n^{1-\epsilon})$ for any $\epsilon > 0$.

This corresponds to Case 1 of the Master Theorem.

 

Step 2: Determine the asymptotic complexity

According to Case 1 of the Master Theorem, if $f(n) = O(n^{\log_b a - \epsilon})$, then $T(n) = \Theta(n^{\log_b a})$.

In this case, $T(n) = \Theta(n^1) = \Theta(n)$.

 

Answer:  The correct option is $\mathbf{\Theta(n)}$.

 
Position:
Show:

Related questions

0 0 votes
0 0 answers
74
74 views
DΛΞMON asked Sep 29
74 views
Q.${Solve}$ ${Recurrence}$.$T(n) = T\left(\frac{n}{15}\right) + T\left(\frac{n}{10}\right) + 2T\left(\frac{n}{6}\right) + \sqrt{n}$ 
3 3 votes
1 1 answer
292
292 views
Shubham Sharma 2 asked Apr 19
292 views
Which of the following is correct solution of the given recurrence relation? $T(n)=3 T(n / 4)+n \log n$$\theta(n \log n)$$\theta\left(n^{2} \log n\right)$$\theta\left(n(\...
4 4 votes
2 2 answers
1.1k
1.1k views
gatecse asked Feb 23
1,107 views
Consider that the quick sort algorithm is used to sort an array of $n$ distinct randomly ordered elements. In every call, the pivot is chosen as the first element of the ...
15 15 votes
7 7 answers
2.3k
2.3k views
gatecse asked Feb 23
2,311 views
Which of the following can be recurrence relation(s) corresponding to an algorithm with time complexity $\Theta(n)$?$T(n)=T(n-1)+1, \quad T(1)=1$$T(n)=2 T\left(\frac{n}{2...