📜  为什么 O(n) 比 O( nlog(n) ) 好? - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:09.784000             🧑  作者: Mango

代码示例1
It turned out, I misunderstood Logn to be lesser than 1. As I asked few of my seniors i got to know this today itself, that if the value of n is large, (which it usually is, when we are considering Big O ie worst case), logn can be greater than 1.

So yeah, O(1) < O(logn) < O(n) < O(nlogn) holds true.

(I thought this to be a dumb question, and was about to delete it as well, but then realised, no question is dumb question and there might be others who get this confusion so I left it here.)