is (n+1)! in the order of (n!)? can you show me a proof?

Viewed 1763

What about (n-1)!?

Also if you could show me a proof that would help me understand better.

I'm stuck on this one.

3 Answers

To show that (n+1)! is in O(n!) you have to show that there is a constant c so that for all big enough n (n > n0) the inequality

(n+1)! < c n!

holds. However since (n+1)! = (n+1) n! this simplifies to

n+1 < c

which clearly does not hold since c is a constant and n can be arbitrarily large.

On the other hand, (n-1)! is in O(n!). The proof is left as an exercise.

(n+1)! = n! * (n+1)

O((n+1)*n!) = O(nn!+n!) = O(2(nn!)) = O(n*n!) > O(n!)

(n-1)! = n! * n-1

O(n-1)! = O(n!/n) < O(n!)

I wasnt formally introduced to algorithmic complexity so take what I write with a grain of salt

That said, we know n^3 is way worse than n, right?

Well, since (n + 1)! = (n - 1)! * n * (n + 1)

Comparing (n + 1)! to (n - 1)! is like comparing n to n^3

Sorry, I dont have proof but expanding the factorial as above should lead to it

Related