1

For which case are both $f(n) \ne O(g(n))$ and $g(n) \ne O(f(n))$ true?

I have following answer to this which I could not understand:

Sometimes true: For $f(n) = 1$ and $g(n) = |n \sin n|$ it is true, while for any $f(n) = O(g(n))$, e.g. $f(n) = g(n) = 1$, it is not true.

Please someone help in understanding:

  • For which case is it sometimes true? An explanation with example will be much appreciated.

  • What is meaning of "||" in this?

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
A known
  • 11
  • 1

1 Answers1

1

Consider the following statement about two functions $f,g$:

$f(n) \neq O(g(n))$ and $g(n) \neq O(f(n))$.

The question wants you to choose which of the following holds:

  • The statement holds for every $f,g$.

  • The statement holds for no $f,g$.

  • The statement holds for some $f,g$, and doesn't hold for other $f,g$.

The third option is correct in your case, and this is the meaning of "sometimes true".

Indeed, if $f(n) = g(n) = 1$ then the statement doesn't hold. Conversely, if $f(n) = 1$ and $g(n) = |n\sin n|$ (where $\left|\cdot\right|$ denotes absolute value) then the statement does hold.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503