Give an example of a one-to-one function f(n) that is neither O(n) nor Ω(n) and justify it

97 Views Asked by At

I have found a lot of examples of such functions, for example, here, but I don't understand how to come up with such and how it is explained/proved like it is done in the top answer to that question.

Could somebody please help me come up with one and explain it to me?

Thank you in advance!

1

There are 1 best solutions below

0
On

Let $A= \{2^{n^2}:n\in \mathbb N\}, B = \{3^{n}:n\in \mathbb N\}.$ On $A$ define $f(2^{n^2}) = 2^n, n=1,2\dots$ On $B$ define $f(3^{n}) = 3^{n^2}, n=1,2\dots$ Then $f$ maps $A\cup B$ bijectively to $f(A\cup B).$

The sets $\mathbb N\setminus (A\cup B)$ and $\mathbb N\setminus f(A\cup B)$ are both countably infinite, so we can choose a bijection $g$ between them.

The function $h=f$ on $A\cup B,$ $h= g$ on $\mathbb N\setminus (A\cup B)$ is then a bijection from $\mathbb N$ to $\mathbb N.$ By the first paragraph, $h(n)$ is neither $O(n)$ or $\Omega(n).$