Trying to find an asymptotic relationship between:
- $f(n)$ and $n^2$ where $f(n)$: if n is even, $f(n) = 8n$. if n is odd, $f(n) = 5.5n^2$.
Not sure how to approach when the function is conditional. Am I correct to say that $f(n) = O(n^2)$ and why?
Any and all help would be appreciated.
You can consider each case separately at first. $f(n)=O(n^2)$ as $n\to\infty$ means there exists $C>$ such that $f(n)<Cn^2$ for all $n\geq 1$. One approach to showing this is to try to find $C_1>0$ such that $f(n)<C_1n^2$ for all even $n$, and $C_2>0$ such that $f(n)<C_2n^2$ for all odd $n$. If you can do that, then $C=\max\{C_1,C_2\}$ will work for all $n$.