Back to Developer Roadmap

Logarithmic

src/data/roadmaps/datastructures-and-algorithms/content/[email protected]

4.0536 B
Original Source

Logarithmic

Logarithmic time complexity (O(log n)) often indicates that the algorithm halves the size of the input at each step. It's more efficient compared to linear time complexity. Binary search is a classic example of logarithmic time complexity where at every step, the algorithm breaks the list into half until it finds the desired element. As the size of the input increases, the growth of the time taken by an algorithm with logarithmic complexity grows slowly because it divides the problem into smaller parts in each step.