How to know when Big O is Logarithmic?

Léo Léopold Hertz 준영 picture Léo Léopold Hertz 준영 · Apr 15, 2009 · Viewed 7.2k times · Source

My question arises from the post "Plain English Explanation of Big O". I don't know the exact meaning for logarithmic complexity. I know that I can make a regression between the time and the number of operations and calculate the X-squared value, and determine so the complexity. However, I want to know a method to determine it quickly on paper.

How do you determine logarithmic complexity? Are there some good benchmarks?

Answer

Mitch Wheat picture Mitch Wheat · Apr 15, 2009

Not rigorous, but it you have an algorithm that is essentially dividing the work needed to be done by half on each iteration, then you have logarithmic complexity. The classic example is binary search.