Is O(N) better or O(NLogN) better?

I am getting confused in this, if N is too large then the combined value of NLogN will be less than O(N) ?

@raghav6 NlogN > N so O(N) is no doubt better than O(NlogN)

But suppose our n=4 let’s consider it worst case, so log4=0.60 and nlogn = 4*0.60= 2.4 which is less than n=4 itself?

@raghav6 You are considering the base 10. Consider it as 2 for these case.
1

So, we consider base2 for example binary search , our array gets reduced to half.

Yes for Binary search the time complexity in Log(n) not nlog(n). So it will be less than O(n).
But N*Log(N) is greater than O(N).

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.