in Algorithms edited by
2,301 views
0 votes
0 votes
Big 'O' estimate for Factorial Functions and Logarithm of Factorial Function i.e. n! and log n! is

a)O(n!) and O(n log n)

b)O(nn) and O(n log n)

c)O(n!) and O(log n!)

d)O(nn) and O(log n!)
in Algorithms edited by
2.3k views

3 Answers

1 vote
1 vote

Conceptually all options are correct 
Because Big Oh means   f(n) = O(g(n))            f(n) is less than or equal to g(n)

look first of all n! = n*(n-1)*(n-2)*..........*1 < n*n*n*........
so NN can be upper bound to n! 
2nd is log(n!) = log(n*(n-1)*(n-2)*..........*1)   < log(n*n*n*........)

and log(nn) = n*logn which can be a upper bound to log(n!)

 

by

4 Comments

@aehkn, I haven't understood this part, especially n! is no doubt less than nn. But why nis being upper bound to n!? This u explain. Yeah. :)

0
0

take whatever value of n  n! will always be less than or equal to nn

Big O means n! will always be less than or equal to n power n so its an upper bound

0
0
Thanks again. :)
0
0
Actually, Big Oh means the value greater than or equal to.

so if you have fact(n) then we know n^n is greater than that.

so we took to log on both sides and we got log(fact(n))<=log(n*log(n)).
0
0
0 votes
0 votes
b) should be correct

Since n! < n^n

So n! = O(n^n) (This bound is more strict) and log(n!) =O( n log(n))
0 votes
0 votes
Option b

1 comment

@Purvi, Please work it out if u can. It'd be a big help indeed. :)
0
0