Reputation:
So i know that f(n)=n^n
has a bigger growth compared to g(n)=n!
and t(n)=2^n
has a less growth
but i can't find any function that has the same order as n! and is not a factorial function
do we have such a function which is Θ(n!) and is not factorial? if we do have such functions then can you mention a few?
Upvotes: 1
Views: 346
Reputation: 3036
Yes - one of the most famous asymptotic equivalent of n!
is given by its Stirling's approximation, namely:
(1) n! ~ sqrt(2.pi.n).(n/e)^n
Note the use of equivalence which is stronger than the Θ relationship. The former implies the latter:
(2) f(n) ~ g(n) => f(n) = Θ(g(n))
With (1) and (2) you get:
n! = Θ(sqrt(2.pi.n).(n/e)^n)
Since you are asking for a Θ approximation rather than an equivalence, you can create as many functions as you want, for instance multiplying by 2 - sin(n)
(which isn't particularly useful!):
n! = Θ((2 - sin(n)).sqrt(2.pi.n).(n/e)^n)
Upvotes: 4
Reputation: 15035
A simple example is computing all possible permutations of an array:
In total there are n(n - 1)(n - 2)... = n! permutations (if elements are unique or tagged).
Upvotes: 1