edited by
7,462 views
23 votes
23 votes

The recurrence relation

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

has the solution $T(n)$ equal to

  1. $O(n)$

  2. $O (\log n)$

  3. $O\left(n^\frac{3}{4}\right)$ 

  4. None of the above

edited by

4 Answers

Best answer
23 votes
23 votes

Answer: A

According to Master theorem,
$T(n) = aT(\frac{n}{b}) + f(n)$ can be expressed as:
$T(n) = [n^{\log_ba}][T(1) + u(n)]$
where $u(n) = \Theta(h(n))$ where $h(n) = \frac{f(n)}{n^{\log_ba}} = \frac{n}{n^{\log_43}} = n^{1-\log_43}$ as $h(n) = n^r$ where $r>0$.
So, $T(n) = [n^{\log_ba}][T(1) + u(n)] = T(n) = [n^{\log_43}][T(1) + \Theta(n^{1-\log_43})] = \Theta(n^{1})$.

edited by
34 votes
34 votes

Using Extended Master Theorem

$T(n)=3T(\frac{n}{4})+n^{1} \log^{0} n$

$a=3 , b =4 , k=1 , p=0$

case 3 : $a<b^{k}$  is true
case 3.a follows as $p=0$

Hence $T(n)$ is $\Theta (n^{1} \log^{0} ) \Rightarrow \Theta (n )$

20 votes
20 votes
Master theorem: $n^{\log_4 3} < n$, so it is $O(n)$.
edited by
Answer:

Related questions

11.3k
views
3 answers
31 votes
Kathleen asked Oct 9, 2014
11,268 views
Quick-sort is run on two inputs shown below to sort in ascending order taking first element as pivot$1, 2, 3, \dots n$$n, n-1, n-2, \dots, 2, 1$Let $C_1$ and $C_2$ be the...
3.6k
views
2 answers
24 votes
Kathleen asked Oct 9, 2014
3,590 views
Consider the following program that attempts to locate an element $x$ in an array $a[ ]$ using binary search. Assume $N 1$. The program is erroneous. Under what conditio...
7.8k
views
7 answers
25 votes
Kathleen asked Oct 9, 2014
7,819 views
Let $G$ be the directed, weighted graph shown in below figureWe are interested in the shortest paths from $A$.Output the sequence of vertices identified by the Dijkstra�...
5.3k
views
1 answers
26 votes
Kathleen asked Oct 9, 2014
5,279 views
A complete, undirected, weighted graph $G$ is given on the vertex $\{0, 1,\dots, n -1\}$ for any fixed ‘n’. Draw the minimum spanning tree of $G$ ifthe weight of the ...