Tilde Notation
One way to simplify our analysis of an algorithm employing mathematical methods is to use tilde notation. Tilde notation works of the two core principles.
- Estimate running time (or memory) as a function of input size N.
- Ignore lower order terms.
- When N is large, terms are negligible.
- when N is small, we donβt care.
Example 1: 1/6 N POW(3) + 20N + 16 ~ 1/6 N POW(3) Example 2: 1/6 N POW(3) + 100 N POW(4/3) + 56 ~ 1/6 N POW(3) Example 3: 1/6 N POW(3) + 1/2 N POW(2) + 1/3 N ~ 1/6 N POW(3)
To surmise:
- In principle: Accurate Mathematical Models are available.
- In Practice:
- Formulas can be complicated.
- Advanced mathematics might be required.
- Exact models best left for the experts.
Most computer programmers will use approximate models to analyse algorithms.