Logarithmic execution performance O(log N)
Logarithmic execution time O(log N)
This kind of algorithm produces a logarithmic performance. The growth curve is at its most at the start but flattens out in a logarithmic way. For example, using 1 data set might take a second. 10 data sets might take 2 seconds. 100 data sets might take 3 seconds and so on. The numbers of data items used seems to have a very small effect on the performance. We can represent this as a graph:
O(log N) in programming
A classic search algorithm that displays this kind of Big O characteristic is the binary search. For large sets of data, it is so much quicker than a linear search, for example. Each time you go through the data in a binary search, the data that you need to search through next time decreases by half. This is why you can find what you want very quickly, even with large data sets. Of course, binary searches require the data to be in order so a sort algorithm has to be applied to unsorted data first and this has an impact on the overall efficiency of the search process.
You can see how a binary search works here.
You can see a more detailed binary search here.
You can see a binary search implemented in Python here.
Another example that display O(log N) include the insert and find operations in a binary search tree.