-3

Using only the definition of O()?

Adam
  • 355
  • 1
  • 6
  • 12

2 Answers2

1

You want to calculate the limit of

  (n * log(n)) / (n ^ 2) =
= log(n) / n =
= 0 if n approaches infinity.

because log(n) grows slower than n.

1

You need to prove by contradiction. Assume that n^2 is O(n*log(n)). Which means by definition there is a finite and non variable real number c such that

n^2 <= c * n * log(n) 

for every n bigger than some finite number n0.

Then you arrive to the point when c >= n /log(n), and you derive that as n -> INF, c >= INF which is obviously impossible.

And you conclude n^2 is not O(n*log(n))

UmNyobe
  • 22,539
  • 9
  • 61
  • 90