![Checkout](https://naologiccom.imgix.net/website-update/general/checkout.png?auto=compress&w=64&fm=png)
Start free trial
Take Naologic for a spin today, no credit card needed and no obligations.
Start free trial Question
Asymptotic Computational Complexity - Which is better O 1 or O log N?
Answer
Even though O(log n) and O(1) are both efficient, O(1) usually works better. Nevertheless, it should be remembered that O(log n) might occasionally surpass O(1), particularly when dealing with tiny inputs. However, O(log n) typically takes more time than O(1) as the input size 'n' increases.