Big O(*)… What does it mean?
A lot of programmers make good applications for PC, but not everyone know something about complexity of algorithms.
Big O notation tells you about CPU (time) usage, memory usage, disk usage and network usage in program.
Big O notation describes the asymptotic behavior of functions.
It tells you how fast a function grows or declines.
There are some simple operations (for example, one arithmetic operation, one assignment, one read).
These operations has constant complexity – O(const).
More interesting combinations of function can have logarithmic (O(log(N))), polylogarithmic (O(log(N)const)), linear (O(N)), polynomial (O(Nconst)) or exponential (O(constN)) complexity.
The complexity of algorithm is defined with complexity the most difficult element.
For example, cycle “While () ” has O(N) complexity.
If we past in program cycles “While ()” then our algorithm has O(N*M)notation.
Many programmers is using linear search in algorithms.
Doubtless, this method has linear complexity.
But there is binary search.
The key idea of binary search is to inspect a middle element and to compare it with the search argument key.
This method has logarithmic complexity O(log(N)).
It can save resources of computer.
It is a well-known fact that good program shouldn’t be resource-intensive.
If programmer knows features of using different functions, he can make really good programs.
Knowledge about complexity of algorithms helps everybody become expert.