Is time complexity O(n^2)
or O (n(logn)^2)
better?
I know that when we simplify it, it becomes
O(n) vs O((logn)^2)
For each constant k
asymptotically log(n)^k < n
.
Proof is simple, do log on both sides of the equation, and you get:
log(log(n))*k < log(n)
It is easy to see that asymptotically, this is correct.
Semantic note: Assuming here log(n)^k == log(n) * log(n) * ... * log(n) (k times)
and NOT log(log(log(...log(n)))..) (k times)
as it is sometimes also used.