Revisiting Algorithm Analysis April 24, 2009
Posted by jagadeeshbp in Uncategorized.Tags: algorithms, Big O, computer science, theory
add a comment
Yet again, another subject that I dreaded due to the incomprehensible and intangible approach in which the subject was taught. One fundamental question I had was, knowing the definition of Big O notation, what does really mean?
Let me try to put them in my perspective. Think that I am planning to go and buy a new shirt and I do not know what its exact cost is. But to make sure that I have enough money to buy one, I kind of predict, it would cost at the maximum of say a $1000 (I would love it as a gift, better). That is sort of the upper bound. I know that the cost will not go beyond that; even in the worst case.
Big O notation is similar to that. It defines an upperbound to the complexity of the function. Consider the case of sorting elements, the time taken (considering time complexity, we can worry about space complexity some other time) is given by the function
. By the definition of Big O, the upper bound is
. We can get this by removing all constants, and lower order terms, leaving us with just
.
By definition, means that for some constants
and
,
,
Let us try to interpret this. part means that we are considering the positive values of
.
Following shows how the graphs of the functions ,
and
looks like.

It is can be seen that is above
.
So we have for ,
, where
.