recategorized by
1,171 views
1 votes
1 votes

Consider the algorithm that solves problems of size $n$ by recursively solving two sub problems of size $n-1$ and then combining the solutions in constant time. Then the running time of the algorithm would be:

  1. $O(n)$
  2. $O(\log n)$
  3. $O(n\log n)$
  4. $O(n^2)$
recategorized by

1 Answer

1 votes
1 votes
recurrence relation :

T(n)=2.T(n-1)+c , n>0

T(n)=1, n=0.

as per back substitution method,

T(n) = 2$^k$.T(n-k)+ 2$^{k-1}$c+....+2$^0$c

T(n) = 2$^n$.T(0)+ 2$^{k-1}$c+....+2$^0$c

T(n) =  2$^{n+1}$-1

T(n) =  O(2$^n$)

Related questions

3 votes
3 votes
4 answers
1
2 votes
2 votes
2 answers
2
gatecse asked Dec 9, 2020
730 views
Number of letter repeated in the given word $’MEASUREMENTS’$ are indicated in front of each alternative. Identify the correct alternative.$M_2E_2A_2S_2U_1R_1N_1T_1$$M...
2 votes
2 votes
1 answer
3
gatecse asked Dec 9, 2020
712 views
If $09/12/2001(DD/MM/YYYY)$ happens to be Sunday, then $09/12/1971$ would have been a:WednesdayTuesdaySaturdayThursday
2 votes
2 votes
2 answers
4
gatecse asked Dec 9, 2020
778 views
If a cube with length, height and width equal to $10\; cm$, is reduced to a smaller cube of height, length and width of $9\; cm$ then reduction in volume is :$172\;cm^3$$...