In order to prove that $n$ is $O(n\log n)$, as per my understanding if we have to say $f(n)$ is $O(g(n))$ then $\lim\limits_{n \to \infty} \frac{f(n)}{g(n)}= C$
Then in that case when I am taking the limit $\lim\limits_{n\to\infty} \frac{n}{n\log n}= \frac{1}{1+\log n}$
This is not a constant but when I do trial and error I am getting $C$ and $n_0$ as $1$ and $2$
Where exactly I am doing wrong can someone please help me
Regards, Siddartha
Taking the limit,
$$\lim_{n \to \infty} \frac{n}{n\log(n)} = \lim_{n \to \infty} \frac{1}{\log(n)}= 0$$ which is a constant, thus $n$ is $\mathcal{O}(n\log(n))$.
EDIT: If you want to use the more traditional definition (i.e. finding a $c$ and $x_0$ such that for all $x \geq x_0$, $x \leq c \cdot x\log(x)$.) If we pick $c=1$ and $x_0 = 10$, then for all $x \geq x_0 = 10$, we have $\log(x) \geq \log(10) = 1$, thus, $$x = x \cdot 1 \leq x \cdot \log(x) = 1\cdot x\log(x) = c\cdot x\log(x).$$
Thus, we have found a $x_0$ and $c$ that satisfies the definition, so $n$ is $\mathcal{O}(n\log(n))$.