• edited by
13,476 views
31 31 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

5 Answers

Best answer
34 34 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
49 49 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 )$

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

Related questions

12 12 votes
1 answers 1 answer
2.6k
2.6k views
Kathleen asked Oct 9, 2014
2,608 views
The Fibonacci sequence $\{f_1, f_2, f_3 \ldots f_n\}$ is defined by the following recurrence:$$f_{n+2} = f_{n+1} + f_n, n \geq 1; f_2 =1:f_1=1$$Prove by induction that ev...
42 42 votes
5 answers 5 answers
17.8k
17.8k views
Kathleen asked Oct 9, 2014
17,775 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...
27 27 votes
2 answers 2 answers
6.8k
6.8k views
Kathleen asked Oct 9, 2014
6,770 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...
37 37 votes
8 answers 8 answers
15.2k
15.2k views
Kathleen asked Oct 9, 2014
15,245 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’s...