Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know when Big O is Logarithmic?

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?

like image 709
Léo Léopold Hertz 준영 Avatar asked Apr 15 '09 00:04

Léo Léopold Hertz 준영


1 Answers

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.

like image 175
Mitch Wheat Avatar answered Sep 23 '22 00:09

Mitch Wheat