Asymptotic complexity of algorithms: Difference between revisions
No edit summary |
|||
Line 5: | Line 5: | ||
== Asymptotic complexity vs. run time == | == Asymptotic complexity vs. run time == | ||
Roughly speaking, the run time of an algorithm is measured by the number of [[Algorithms and correctness#Operations and instructions|operations]] executed by the machine. However, in theoretical considerations, the run time is estimated by the algorithm's '''asymptotic complexity'''. In [[Asymptotic comparison of functions|asymptotic]] considerations, constant multiplicative factors are completely disregarded. Therefore, it does not matter how fast the machine and the algorithm's implementation | Roughly speaking, the run time of an algorithm is measured by the number of [[Algorithms and correctness#Operations and instructions|operations]] executed by the machine. However, in theoretical considerations, the run time is estimated by the algorithm's '''asymptotic complexity'''. In [[Asymptotic comparison of functions|asymptotic]] considerations, constant multiplicative factors are completely disregarded. Therefore, it does not matter how fast the machine and how smart the algorithm's implementation is. | ||
== Input parameters == | == Input parameters == |
Revision as of 11:58, 28 May 2015
Corresponding page on the original wiki (to be ported asap):
Asymptotic complexity vs. run time
Roughly speaking, the run time of an algorithm is measured by the number of operations executed by the machine. However, in theoretical considerations, the run time is estimated by the algorithm's asymptotic complexity. In asymptotic considerations, constant multiplicative factors are completely disregarded. Therefore, it does not matter how fast the machine and how smart the algorithm's implementation is.
Input parameters
For the inputs of an algorithmic problem, one or more characterizing (numerical) parameters are needed, from which the total size of an input can be computed.
- The number of elements in sets, maps, and sequences
- The (maximum) size of an element in a set, map, or sequence.
Asymptotic complexity
For a selection [math]\displaystyle{ n_1,\ldots,n_k }[/math] of characterizing parameters, the asymptotic complexity of an algorithm is defined as follows.
- In the worst case: by the function [math]\displaystyle{ f:\mathbb{N}^k\rightarrow\mathbb{R}^+ }[/math] such that the maximum number of operations [math]\displaystyle{ f(n_1,\ldots,n_k) }[/math]
- best case:
- average case:
Remar
- An algo may have different complexity bounds, based on different parameters
Input size and polynomial complexity
The size of an input is the
For a given input,