Penguin
Note: You are viewing an old revision of this page. View the current version.

BigOhNotation? is a way of describing the cost of an Algorithm or block of code. It describes the element of the algorithm that, as it increases, has the largest effect upon the overall cost of the algorithm or equation.

A mathematical example would be
5n^2 + 6n - 2

This is O(n^2) because the part of the equation that has the largest overall effect on the value of the equation is the n^2 component. The 5, being constant, is basically disregarded.

Obviously, when writing code one should be aware of these concepts. Iterating over an array of items is O(n), iterating over the same array again within the first loop (say, to check for dupes) becomes O(n^2), and so on. Hash lookups are in general O(1)?.

See http://www.cs.strath.ac.uk/mdd/teaching/alg&comp/big_oh.html

Some typically used orders are O(1)?, O(log N), O(N), O(N log N), O(N^2), in increasing cost.

lib/main.php:944: Notice: PageInfo: Cannot find action page

lib/main.php:839: Notice: PageInfo: Unknown action