Is time complexity O(n^2) or O (n(logn)^2) better?
O(n^2)
O (n(logn)^2)
I know that when we simplify it, it becomes
O(n) vs O((logn)^2)
O(n^2) vs. O(n*log(n)^2) <=> O(n) vs. O(log(n)^2) (divide by n) <=> O(sqrt(n)) vs. O(log(n)) (square root) <=> polynomial vs. logarithmic
Logarithmic wins.