retagged by
1,014 views
0 votes
0 votes
Q.1 :Give a big-O estimate for f(n)=3n log(n!) + ($n^2$+3)log n, where n is positive integer

Answer is given as O($n^2$ logn), Why it is not O($n^3$)?

Q.2: Find the least integer n such that f(x) is O($x^n$)

f(x)=2$x^2$ + $x^3$logx

here n is given as 4, why it can not be 3??
retagged by

1 Answer

1 votes
1 votes
Ans1) I am not getting $O(n^{3})$ but let me walk you through my approach to this problem.

$3nlog(n!)=3n*\left \{ log(n*(n-1)*(n-2)*..........*2*1) \right \}\\=>3n*\left \{ log(n)+log(n-1).......log(2)+log(1)\right \}\\=>log(n)^{3n}+log(n-1)^{3n}+.....+log(2)^{3n}+0^{3n}\\=>O(3n*log(n))\\\\(n^{2}+3)*log(n)=n^{2}*log(n) + 3log(n)=O(n^{2}log(n))\\\\ \therefore O(3n*log(n))+O(n^{2}log(n))=O(n^{2}log(n))$

Ans 2)  n should be greater than 3 ,for if it's 3,$O(x^{3})<O(x^{3}*log(x))$ but if n=4, $O(x^{4})>O(x^{3}*log(x))$,and so $O(f(x))=O(x^{4})$

Related questions

0 votes
0 votes
1 answer
1
Ankit Jaiswal asked Mar 4, 2019
364 views
1 votes
1 votes
1 answer
2
1 votes
1 votes
1 answer
3