1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Big-O Notation
The growth of functions
Formal mathematical definition:
Let T(n) and f(n) be two positive functions from the integers or the real numbers to the real numbers
We write T(n) ∊ O(f(n)), and say that T(n) has order of f(n), if there are positive constants M and n₀ such that
T(n) ≤ M×f(n) for all n ≥ n₀
The idea is to establish an upper boundary for the growth of the function T(n) for large n, specified by the function f(n) that is usually much simpler than T(n)
Big O Notation in General
Example Notation
Dominant Terms Examples
Single Loops with O(1) Instructions
Single Loops with O(f(n)) Instructions
Nested Loops
Complexity is equal to the number of times innermost statement executed*complexity of statement
Complexity of inner loop*complexity of outer loop
Care needed if loops are not independent