It is said that integer factorization is an NP problem.
Why isn't it P? You can solve it in $O(\sqrt{n})$ time with trial factorization, and since $\sqrt{n} = n^{1/2}$, to me that looks like a number of form $n^k$ which is a polynomial.
I am having difficulty determining what P vs NP vs NP-Complete vs NP-Hard means because I don't know how to separate the definitions and how complexity is measured and defined.
Let $k$ denote the length of the input value $n$.
Since $k=\log_2n$, a complexity of $O(\sqrt{n})$ is equivalent to $O(\sqrt{2^k})$.
Since $\sqrt{2^k}=2^{k/2}$, this complexity is obviously exponential in terms of input-length.