3. Big-O (2)
10/02/23
Classification of Functions
Often need a way to group together functions by their scaling behaviour, and the classification should
- Remove unnecessary details
- Be (relatively) quick and easy
- Be able to deal with weird functions that can happen to runtime
- Still be mathematically well-defined
Ratios vs. big-Oh
- can be even if the ratio does not exist
- Therefore, big-Oh can be used in situations that ratios cannot
- The possibility of 'weird functions' means that big-Oh is more suitable than ratios for doing analysis of efficiency of programs
Binary relations, R, are characterised by potential properties:
- Reflexive -
- Symmetric - iff
- Transitive - &
Reflexive
- Trivial for any function
- is
- as just take , and use
Symmetric
- Big-Oh is NOT symmetric
- is but is not
- Only takes one counterexample to show that we cannot say it is symmetric
Transitive
- Given is and is we can show is
Set
- Big Oh as a binary relation is reflexive and transitive but not symmetric
- May help to thing of as a set of functions with each function f in the set, satisfying is
- Behaves like but not
Rules for quick big-Oh proofs
- Reverting the definition each time is time-consuming and error prone
- Better to develop a set of rules that allow us to very quickly find big-Oh