pc2-brazil
- 198
- 3
Homework Statement
Give a big-O estimate of the product of the first n odd
positive integers.
Homework Equations
Big-O notation:
f(x) is O(g(x)) if there are constants C and k such that
|f(x)| ≤ C|g(x)| whenever x > k.
The Attempt at a Solution
The product of the first n odd integers can be given by:
P(n)=1\times 3\times 5\times 7\times...\times (2n-1)
For n > 0, no element in the above sequence will be greater than (2n-1). Thus:
1\times 3\times 5\times 7\times...\times (2n-1)\leq (2n-1)\times (2n-1)...\times (2n-1)=(2n-1)^n
So:
P(n) ≤ (2n-1)n whenever n > 0
I could stop here and say that
P(n) is O((2n-1)n)
But to simplify I think I could consider that:
P(n) ≤ (2n-1)n ≤ (2n)n
Thus,
P(n) is O((2n)n)
Is this reasoning correct?
Thank you in advance.
Last edited:
