I'm trying to compare two functions, such as f(n)=n^n and g(n)=n^10^10. I'm unsure if f(n) is O(g(n)) or vise-vera where g(n) is O(f(n)). From my understanding, n^n can be worse than n! and although g(n) is being raised to a large constant, it can be bounded by f(n) if multiplied by a certain constant. I am new to this topic, how can you see if a run time function can be bound by another, such as these?
Asked
Active
Viewed 187 times
1 Answers
1
If $$\limsup_{n \rightarrow \infty} \frac{g(n)}{f(n)} < \infty,$$ then we have that $g(n)$ is $O(f(n))$.
That is actually (almost) the definition of the big-O notation (modulo the $| \cdot |$ function that I left out for readability). You would prove that using your math knowledge. Note that if you can show that $$\lim_{n \rightarrow \infty} \frac{g(n)}{f(n)} < \infty,$$ for strictly increasing positive functions $g$ and $f$, this implies the satisfaction of the first equation. Analyzing the latter function should be part of most computer science curricula.
DCTLib
- 2,817
- 17
- 13