Find $\theta(p)$ so that $\theta\Big(\frac{n^2}{p}\Big)+\theta(n\log p)$ is minimal.
In my parallel programming class there was an algorithm that lead to a complexity of: $$\theta\Big(\frac{n^2}{p}\Big)+\theta(n\log p)$$ Without any sort of an explanation it was said that the optimal complexity would be achieved if: $$\theta(p)=\theta\Big(\frac{n}{\log n}\Big)$$ I fail to see why that's the case. I can see that $\theta(p\log p)=\theta(n)$, however I am unable to make the transition to the answer. Can any one here please help and show how to solve such problems?