Which is better O 1 or O log n?
Photo Credit: Courtesy of 3DStockPhoto (Is 40v better than 20v? image)
O(1) is faster asymptotically as it is independent of the input. ... O(log n) means that the time grows linearly when the input size n is growing exponentially. Note that it might happen that O(log n) is faster than O(1) in some cases but O(1) will outperform O(log n) when n grows as it is independent of input size n.