I am learning about Big O Notation running times and amortized times. I understand the notion of O(n) linear time, meaning that the size of the input affects the g
O(log N)
basically means time goes up linearly while the n
goes up exponentially. So if it takes 1
second to compute 10
elements, it will take 2
seconds to compute 100
elements, 3
seconds to compute 1000
elements, and so on.
It is O(log n)
when we do divide and conquer type of algorithms e.g binary search. Another example is quick sort where each time we divide the array into two parts and each time it takes O(N)
time to find a pivot element. Hence it N O(log N)