O(Log(n)) - Logarithmic Time Complexity
Description: An operation where the time it takes to complete is proportional to the logarithm of the input size. This usually happens in algorithms that divide the input in half each time.
Mathematical Expression of Logarithmic Time Complexity
Let's say you have a number x = 1, and at each step, you are doubling it.
For example:
Alternatively, you can express this in reverse:
This expression means that for a given input size n, an algorithm with logarithmic time complexity will take approximately k operations to solve the problem. Therefore, k is logarithmically proportional to the input size.
Logarithmic time complexity is typical in efficient algorithms such as binary search, where the problem size is halved with each step. This leads to significantly faster performance compared to linear time complexity as the input size increases.