Big O refers to the worst order lead time. It is used to show how well the algorithm scales depending on the size of the data set (n-> number of elements).
Since we are only interested in order, the constant factors are ignored, and any members that grow less rapidly than the dominant member are also deleted. Some examples:
One operation or set of operations is O (1), since it takes some constant time (does not depend on the size of the data set).
O (n) loop. Each element in the data set is looped.
The nested loop is O (n ^ 2). A nested nested loop is O (n ^ 3) and on.
Things like finding a binary tree are log (n), which is harder to show, but at each level of the tree, the possible number of solutions is halved, so the number of levels is log (n) (assuming the tree is balanced).
Something like finding the sum of a set of numbers closest to a given value is O (n!), Since the sum of each subset must be calculated. This is very bad.
Adam shiemke
source share