Saturday, August 9, 2014

Big O Notation : Algorithm Performance

Big-O-Notation is used to measure and express the relative representation of the complexity of an algorithm:

 

Did you ever tried to understand why :

·         Bubble Sort is O( n square )

·         Quick Sort is O( n log n)

or you just remember it by heart and don’t know what’s hiding behind these names/values J

 

Below given are two best explanations I found in a quick search:

http://stackoverflow.com/questions/2307283/what-does-olog-n-mean-exactly

http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o/487278#487278

 

They both use example of Telephone Book and make it so simple to understand the whole thing.

If you understand the Telephone Book example then I guarantee you that you will be able to tell the performance of any algorithm in a quick moment without referring its documentation.

 

Namaste (Greetings)

Anugrah Atreya

 




No comments: