quartz/content/notes/aymptotic-notation.md
Jet Hughes 8a667e5693 update
2022-05-27 14:12:53 +12:00

29 lines
897 B
Markdown

---
title: "asymptotic-notation"
aliases: Big O, Big Theta, Algorithm Analysis
tags:
- cosc201
---
Asymptotic notations are used in computer science to classify algorithms based how its space and time requirements grow as the input grows.
# big O notation
Big O defines a bound for the *upper* bound of the running time (or space) of a algorithm. However, it is possible that the actual running time is much less as it does not take into account special cases ^fb2c3f
## 1 Formal definition
$f(n) = O(g(n))$ if there is some constant $A$ such that $f(n) < A \times g(n)$
# big theta notation
Big theta defines an *upper and a lower* bound for a the running time (or space) of an algorithm.
## 2 Formal definition
$f(n) = \theta(g(n))$ if there are some constants $A$ and $B$ where $0 < B < A$ such that for all sufficiently large $n$, $B \times g(n) \geq f(n) \leq A \times g(n)$