15,340 views
8 8 votes

Let $T(n)$ be defined by $T(1) =10$ and $T(n+1)=2n+T(n)$ for all integers $n \geq 1$. Which of the following  represents the order of growth of $T(n)$ as a function of $n$?

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

2 Answers

Best answer
16 16 votes

 Answer -: $C$

$T(n+1)=2n+T(n)$

           $= 2n+2(n-1)+T(n-1)$

           $ = 2n +2(n-1) + 2(n-2)+T(n-2) ......$

          $  =2n+2(n-1) +2(n-2) ... 2(1)+T(1)$

          $ =2(n+n-1+n-2 ..... 1)+T(1)$

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

          $ = O(n^{2})$ 

selected by
2 2 votes
If you observe:

T(n+1) = T(n) + 2n

It is a decreasing expression.

From the Master's Theorem:
a = 1, b = 1

=> O(n * f(n))  
=> O(n * 2n)  
=> O(n^2)
Answer:
Position:
Show:

Related questions

10 10 votes
3 answers 3 answers
23.7k
23.7k views
go_editor asked Jun 23, 2016
23,688 views
The average depth of a binary search tree is$O(n^{0.5})$$O(n)$$O(\log n)$$O(n \log n)$
7 7 votes
2 answers 2 answers
8.9k
8.9k views
go_editor asked Jun 23, 2016
8,936 views
Which of the following algorithm design technique is used in merge sort?Greedy methodBacktrackingDynamic programmingDivide and Conquer
7 7 votes
5 5 answers
8.0k
8.0k views
go_editor asked Jun 22, 2016
7,992 views
Consider the following pseudocodex:=1; i:=1; while ( x <= 500) begin x:=2^x; i:=i+1; endWhat is the value of $\textsf{i}$ at the end of the pseudocode?$4$$5$$6$$7$
4 4 votes
3 answers 3 answers
9.4k
9.4k views
ajit asked Oct 1, 2015
9,381 views
Number of comparisons required for an unsuccessful search of an element in a sequential search organized, fixed length, symbol table of length L isLL/2(L+1)/22L