Asymptotic Analysis
Asymptotic analysis describes how an algorithm's resource use grows as input size
Prerequisites
Prerequisites: functions, inequalities, and limits.
Definition
Let
Usually
Usually
Notation
| Notation | Meaning | Formal definition |
|---|---|---|
|
|
Asymptotic upper bound | There exist constants
|
|
|
Asymptotic lower bound | There exist constants
|
|
|
Asymptotically tight bound | There exist constants
|
Examples
- Linear search worst-case time is
: it may inspect every item, and it never inspects more than items. - Binary search worst-case time is
: each comparison halves the remaining sorted search interval. -
, because constants and lower-order terms are dominated for large . -
is true but loose; alone does not mean "best possible."
Worked Example
Show that
For
so
so
Common Mistakes
- Saying Big-O means exact runtime; it is only an upper bound.
- Writing
instead of simplifying to . - Treating
like "best case"; it is lower-bound notation, not automatically one case label. - Ignoring the phrase "for all sufficiently large
." - Comparing algorithms only by asymptotic order when constants or input sizes dominate in practice.
Connections
| Related note | Use |
|---|---|
| Learning Paths | Navigation hub |
References
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein, Introduction to Algorithms, 3rd ed., MIT Press, ISBN 978-0-262-03384-8. ↩︎