Start free trial
Take Naologic for a spin today, no credit card needed and no obligations.
Start free trial

Asymptotic Computational Complexity - Which is better O 1 or O log N?


While O(1) and O(log n) are both efficient, O(1) generally performs better. However, it's important to note that O(log n) can sometimes outperform O(1), especially with smaller inputs. But as the input size 'n' grows, O(log n) tends to take more time compared to O(1).