retagged by
401 views

2 Answers

Best answer
7 votes
7 votes

It's very simple, Check this.

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

If you expand this then you get

T(n) = $ 1 log 1 + 2 log 2 + 3 log 3 + 4 log 4 + ........ + (n-1) log (n-1) + n log n $

T(n) <= $ n log n + n log n + n log n + n log n + ........ + n log n + n log n $

T(n) <= $ n * (n log n) $

T(n) <= $ n^2 log n $

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

selected by
0 votes
0 votes
T(n)=T(n-1)+nlogn

expand by substitution..

T(n)=T(n-k)+(n-(k+1))log(n-(k+1))+.........+(n-3)log(n-3)+(n-2)log(n-2)+(n-1)log(n-1)+nlogn

     =T(n-k)+(nlog(n-(k+1))+.......+nlog(n-3)+nlog(n-2)+nlog(n-1)+nlogn) - (1log(n-1)+2log(n-2)+3log(n-3)+......+(k+1)log(n-(k+1)))

      =T(n-k)+n(log(n*(n-1)*(n-2)*......3*2*1)-{something }

      =nlog(n^n)

     =O(n^2logn)

Related questions

0 votes
0 votes
1 answer
1
Shreya2002 asked Oct 27, 2022
1,098 views
How to solve this recurrence relationT(n)= T(0.09n) + T(0.91n) + cnwhere c is constant and T(1)=1options are-
1 votes
1 votes
2 answers
2
srestha asked May 10, 2019
874 views
What is the solution of recurrence relation$T\left ( n \right )=T\left ( n-1 \right )+n$
2 votes
2 votes
2 answers
3
pradeepchaudhary asked Jul 14, 2018
9,196 views
Q.6 The time complexity of an algorithm T(n), where n is the input size, is given by— T(n)= T(n-1) + 1/n, if n>1 = 1, otherwise.The order of the algorithm is�...