2. Introduction to big-Oh
06/02/23
Class test - 01/03/23 - Will be about content for that Monday that week!
Classification of Functions
CS needs a way to group functions by scaling behaviour,. Get rid of the unnecessary details.
Experience of CS is that this is best done by the big-Oh notation and family
Stirling's approximation - ( is natural log)
Polynomial function are
Best case of algorithm X is
Big-Oh Notation: Motives
Big-Oh is often applied to runtime, but this is not essential
- Definitions are just in terms of functions
- It is not only for worst case runtime
- Should be designed to be suitable for discussion of runtime functions
- Usually applied to worst case
- Can look at the ratio between two lines
Big-Oh Notation: Definition
Given positive functions and , then we say that if and only if there exists positive constants and such that for all
i.e. exists-exists-forall structure: such that
- Pick , before handling forall . So is not allowed to be a function of
- Cannot pick that depends on
- Can usually take and the definition becomes useless as it would not fail
- Showing something works as is pointless as says nothing about the growth rates at large
The definition does not mention 'worst case of an algorithm runtime'. It does not even mention 'algorithms', only 'functions'