0
$\begingroup$

[THIS IS HOMEWORK so please, don't just provide solutions, help me reasoning]

I'm dealing with the following problem:
Let $f(n)$ be the worst case time complexity of an algorithm A. Assume that there exist $c > 0$ and $n_{0}$, such that for each $n > n_{0}$ there exists an input of size $n$ for which A runs in exactly $c\cdot{g(n)}$ steps.

a. Is it necessarily true that $f(n) = \Omega(g(n))$?
b. Assume $f(n) = O(g(n))$. Is it necessarily true that $f(n) = \Theta(g(n))$?


For a. I think it must be true since the $\Omega$ notation has on it all the elements that are either $f(n) = c\cdot g(n)$ or $f(n) > c\cdot g(n)$ so following the assumption leads to $f(n) = c\cdot g(n)$ being always true, therefore making the whole sentence true. (hope I'm right).
For b. I assume $f(n) = O(g(n))$ and $f(n)=c\cdot{g(n)}$ ($\forall{n>n_{0}}$... of course) then I concluded that since (a) is true then $f(n) = \Theta(g(n))$.

any help will be appreciated, thanks.

  • 0
    Part b. seems a little strange. If you're already given that $f(n) = c\,g(n)$ when $n$ is large enough why do you need to assume that $f(n) = O(g(n))$? Is that exactly how the question was written?2012-04-15
  • 0
    @Antonio yes by 100%2012-04-15
  • 1
    In that case then I think your reasoning is correct. Everything is easy if you know that $f(n) = c \,g(n)$ eventually.2012-04-15

1 Answers 1