1

How to prove $\Theta(g(n))\cup o(g(n))\ne O(g(n))$ ?

Is there a simple example for understanding? Seems there's a gap between $O(g(n))- \Theta(g(n))$ and $o(g(n))$ just from the definition. But I cannot understand What kind of function lays there?

FlowerSun
  • 31
  • 3

2 Answers2

1

Consider the function $$ f(n) = \begin{cases} g(n) & \text{if $n$ is even}, \\ g(n)/n & \text{if $n$ is odd}. \end{cases} $$

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
1

$\Theta$ means "always roughly as big as". Little-o means "getting smaller and smaller compared to". Big-O means "always at most as big as" (all up to some constant).

Functions that are in O (g(n)) but neither in $\Theta (g(n))$ nor in o(g(n)) are those that vary between being as large as g(n) up to a constant and being arbitrary small compared to g(n). That's what Yuval's example does; it is often as large as g(n) but sometimes arbitrarily small compared to g(n). Both infinitely many times.

gnasher729
  • 32,238
  • 36
  • 56