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: | ~ | |
---|---|---|
Example 2: | ~ | |
Example 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.