0

Why is $\log n = O(n)$?

I faced this before and I remember I understood it at that time. But now I cannot know the logic and could not find understandable explanation. Can anyone explain it?

t24akeru
  • 155
  • 1
  • 7
  • Try using limits as explained at https://cs.stackexchange.com/q/824/755. – D.W. Jun 20 '21 at 02:57
  • If you simply plot y=log(x) and y = x, you will see that all values on the log(x) curve will always be smaller than x (i.e. points on y=x). Big O is an simply an upper bound. – Papa Delta Jun 20 '21 at 04:19
  • @PapaDelta I see! Thank you! – t24akeru Jun 20 '21 at 08:57
  • Read the definition of Big-O. The left hand side must not grow faster than the right hand side up to a constant, but is allowed to grow much much slower. So log n = O (n), or O(n^10), or O(n!). – gnasher729 Jun 20 '21 at 11:53

0 Answers0