Algorithm analysisO-notation
Prevailing definitionImplied properties
A general definition of the big oh notation foralgorithm analysis
Kalle Rutanen
Department of MathematicsTampere University of Technology
June 3, 2014
1 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Algorithm analysis
Algorithm
An algorithm is a finite sequence of instructions for transformingdata to another form, a process which can be followed with penand paper.
Example
An algorithm could provide a way to sort a sequence of integers inincreasing order. Then (0, 4, 2, 7) would be transformed to(0, 2, 4, 7).
Algorithm analysis
Algorithm analysis studies the correctness and complexity of agiven algorithm.
2 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Algorithm analysis
Algorithm
An algorithm is a finite sequence of instructions for transformingdata to another form, a process which can be followed with penand paper.
Example
An algorithm could provide a way to sort a sequence of integers inincreasing order. Then (0, 4, 2, 7) would be transformed to(0, 2, 4, 7).
Algorithm analysis
Algorithm analysis studies the correctness and complexity of agiven algorithm.
3 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Algorithm analysis
Algorithm
An algorithm is a finite sequence of instructions for transformingdata to another form, a process which can be followed with penand paper.
Example
An algorithm could provide a way to sort a sequence of integers inincreasing order. Then (0, 4, 2, 7) would be transformed to(0, 2, 4, 7).
Algorithm analysis
Algorithm analysis studies the correctness and complexity of agiven algorithm.
4 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Algorithm analysis
Algorithm
An algorithm is a finite sequence of instructions for transformingdata to another form, a process which can be followed with penand paper.
Example
An algorithm could provide a way to sort a sequence of integers inincreasing order. Then (0, 4, 2, 7) would be transformed to(0, 2, 4, 7).
Algorithm analysis
Algorithm analysis studies the correctness and complexity of agiven algorithm.
5 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Correctness analysis
Correctness analysis
Does the algorithm do what it is claimed to do?
Example of correctness
Prove that a given algorithm sorts any sequence of integers inincreasing order, and does so in finite time for a finite sequence.
6 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Correctness analysis
Correctness analysis
Does the algorithm do what it is claimed to do?
Example of correctness
Prove that a given algorithm sorts any sequence of integers inincreasing order, and does so in finite time for a finite sequence.
7 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Correctness analysis
Correctness analysis
Does the algorithm do what it is claimed to do?
Example of correctness
Prove that a given algorithm sorts any sequence of integers inincreasing order, and does so in finite time for a finite sequence.
8 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Complexity analysis
Complexity analysis
How much time / memory does it take to follow the algorithm ona given input in the worst case / best case / average case (etc.)?
Example of complexity
Prove that a given algorithm never uses more than n(n − 1)/2number of order-comparisons to sort any sequence of n integers.
9 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Complexity analysis
Complexity analysis
How much time / memory does it take to follow the algorithm ona given input in the worst case / best case / average case (etc.)?
Example of complexity
Prove that a given algorithm never uses more than n(n − 1)/2number of order-comparisons to sort any sequence of n integers.
10 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Correctness analysisComplexity analysis
Complexity analysis
Complexity analysis
How much time / memory does it take to follow the algorithm ona given input in the worst case / best case / average case (etc.)?
Example of complexity
Prove that a given algorithm never uses more than n(n − 1)/2number of order-comparisons to sort any sequence of n integers.
11 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
O-notation
Motivation
Detailed complexity analysis is not interesting; big-picture scalingbehaviour is.
Example
A given algorithm to sort a sequence of n integers is analyzed totake 6n2 + 5n + 37 comparisons in the worst case.
Scaling behavior
This is sometimes interesting. However, more interesting is thatthe algorithm’s complexity scales like n2.
Simplification
The O-notation formalizes this scales-like simplification.
12 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
O-notation
Motivation
Detailed complexity analysis is not interesting; big-picture scalingbehaviour is.
Example
A given algorithm to sort a sequence of n integers is analyzed totake 6n2 + 5n + 37 comparisons in the worst case.
Scaling behavior
This is sometimes interesting. However, more interesting is thatthe algorithm’s complexity scales like n2.
Simplification
The O-notation formalizes this scales-like simplification.
13 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
O-notation
Motivation
Detailed complexity analysis is not interesting; big-picture scalingbehaviour is.
Example
A given algorithm to sort a sequence of n integers is analyzed totake 6n2 + 5n + 37 comparisons in the worst case.
Scaling behavior
This is sometimes interesting. However, more interesting is thatthe algorithm’s complexity scales like n2.
Simplification
The O-notation formalizes this scales-like simplification.
14 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
O-notation
Motivation
Detailed complexity analysis is not interesting; big-picture scalingbehaviour is.
Example
A given algorithm to sort a sequence of n integers is analyzed totake 6n2 + 5n + 37 comparisons in the worst case.
Scaling behavior
This is sometimes interesting. However, more interesting is thatthe algorithm’s complexity scales like n2.
Simplification
The O-notation formalizes this scales-like simplification.
15 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
O-notation
Motivation
Detailed complexity analysis is not interesting; big-picture scalingbehaviour is.
Example
A given algorithm to sort a sequence of n integers is analyzed totake 6n2 + 5n + 37 comparisons in the worst case.
Scaling behavior
This is sometimes interesting. However, more interesting is thatthe algorithm’s complexity scales like n2.
Simplification
The O-notation formalizes this scales-like simplification.
16 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Definition
Definition
An O-notation in a set X is a function OX : FX → P(FX ), whereFX = X → R≥0, such that it fulfills the primitive properties.
Example
To formalize our earlier example, (6n2 + 5n + 37) ∈ ON(n2).
Intuition
The set OX (f ) contains those functions in FX which do not scaleworse than f .
17 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Definition
Definition
An O-notation in a set X is a function OX : FX → P(FX ), whereFX = X → R≥0, such that it fulfills the primitive properties.
Example
To formalize our earlier example, (6n2 + 5n + 37) ∈ ON(n2).
Intuition
The set OX (f ) contains those functions in FX which do not scaleworse than f .
18 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Definition
Definition
An O-notation in a set X is a function OX : FX → P(FX ), whereFX = X → R≥0, such that it fulfills the primitive properties.
Example
To formalize our earlier example, (6n2 + 5n + 37) ∈ ON(n2).
Intuition
The set OX (f ) contains those functions in FX which do not scaleworse than f .
19 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Definition
Definition
An O-notation in a set X is a function OX : FX → P(FX ), whereFX = X → R≥0, such that it fulfills the primitive properties.
Example
To formalize our earlier example, (6n2 + 5n + 37) ∈ ON(n2).
Intuition
The set OX (f ) contains those functions in FX which do not scaleworse than f .
20 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Separate concepts
The O-notation used in pure mathematics is a concept separatefrom the O-notation in algorithm analysis; they have differentproperties.
21 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Positive scale-invariance
Definition
OX (αf ) = OX (f ) (∀α ∈ R>0, f ∈ FX )
Intuition
Positive constant factors are not interesting when comparingscaling behaviour.
Example
ON(6n2)
= ON(n2)
22 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Positive scale-invariance
Definition
OX (αf ) = OX (f ) (∀α ∈ R>0, f ∈ FX )
Intuition
Positive constant factors are not interesting when comparingscaling behaviour.
Example
ON(6n2)
= ON(n2)
23 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Positive scale-invariance
Definition
OX (αf ) = OX (f ) (∀α ∈ R>0, f ∈ FX )
Intuition
Positive constant factors are not interesting when comparingscaling behaviour.
Example
ON(6n2)
= ON(n2)
24 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Positive scale-invariance
Definition
OX (αf ) = OX (f ) (∀α ∈ R>0, f ∈ FX )
Intuition
Positive constant factors are not interesting when comparingscaling behaviour.
Example
ON(6n2)
= ON(n2)
25 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Reflexivity
Definition
f ∈ OX (f ) ∀f ∈ FX
Intuition
A function does not scale worse than itself.
Example
n ∈ ON(n)
26 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Reflexivity
Definition
f ∈ OX (f ) ∀f ∈ FX
Intuition
A function does not scale worse than itself.
Example
n ∈ ON(n)
27 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Reflexivity
Definition
f ∈ OX (f ) ∀f ∈ FX
Intuition
A function does not scale worse than itself.
Example
n ∈ ON(n)
28 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Reflexivity
Definition
f ∈ OX (f ) ∀f ∈ FX
Intuition
A function does not scale worse than itself.
Example
n ∈ ON(n)
29 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Transitivity
Definition
f ∈ OX (g) and g ∈ OX (h)⇒ f ∈ OX (h) ∀f , g , h ∈ FX
Intuition
If f does not scale worse than g , and g does not scale worse thanh, then f does not scale worse than h.
Example
n ∈ ON(n2)and n2 ∈ ON
(n3)⇒ n ∈ ON
(n3).
30 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Transitivity
Definition
f ∈ OX (g) and g ∈ OX (h)⇒ f ∈ OX (h) ∀f , g , h ∈ FX
Intuition
If f does not scale worse than g , and g does not scale worse thanh, then f does not scale worse than h.
Example
n ∈ ON(n2)and n2 ∈ ON
(n3)⇒ n ∈ ON
(n3).
31 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Transitivity
Definition
f ∈ OX (g) and g ∈ OX (h)⇒ f ∈ OX (h) ∀f , g , h ∈ FX
Intuition
If f does not scale worse than g , and g does not scale worse thanh, then f does not scale worse than h.
Example
n ∈ ON(n2)and n2 ∈ ON
(n3)⇒ n ∈ ON
(n3).
32 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Transitivity
Definition
f ∈ OX (g) and g ∈ OX (h)⇒ f ∈ OX (h) ∀f , g , h ∈ FX
Intuition
If f does not scale worse than g , and g does not scale worse thanh, then f does not scale worse than h.
Example
n ∈ ON(n2)and n2 ∈ ON
(n3)⇒ n ∈ ON
(n3).
33 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
34 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
35 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
36 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
37 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
38 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ β
OR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
39 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Order-consistency
Definition
f ≤ g ⇒ OX (f ) ⊂ OX (g) ∀f , g ∈ FX
Intuition
If all values of f are at most that of g , then those functions whichdo not scale worse than f do not scale worse than g either
Examples
OX (0) ⊂ OX (f ) ∀f ∈ FX
OR≥1(xα) ⊂ OR≥1
(xβ)
∀α, β ∈ R≥0 : α ≤ βOR≥1
(1
αe loge(β) logβ(x))⊂ OR≥1(xα) ∀α, β ∈ R>0
40 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
41 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
42 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
43 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
44 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
45 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Multiplicativity
Definition
OX (f )OX (g) = OX (fg) ∀f , g ∈ FX
Intuition
The product of a function which does not scale worse than f and afunction which does not scale worse than g does not scale worsethan fg . Every function in OX (fg) is a product of such functions.
Examples
ON(n)ON(n2)
= ON(n3)
OR>0(1/x)OR>0(x) = OR>0(1)
46 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Locality
Definition
f ∈ OX (g)⇔ ∀D ∈ C : (f |D) ∈ OD(g |D)∀f , g ∈ FX ,C ⊂ P(X ) : C is a finite cover of X .
Intuition
An f does not scale worse than g if and only if that holds whenrestricted to a set of a finite cover, for all such sets.
47 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Locality
Definition
f ∈ OX (g)⇔ ∀D ∈ C : (f |D) ∈ OD(g |D)∀f , g ∈ FX ,C ⊂ P(X ) : C is a finite cover of X .
Intuition
An f does not scale worse than g if and only if that holds whenrestricted to a set of a finite cover, for all such sets.
48 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Locality
Definition
f ∈ OX (g)⇔ ∀D ∈ C : (f |D) ∈ OD(g |D)∀f , g ∈ FX ,C ⊂ P(X ) : C is a finite cover of X .
Intuition
An f does not scale worse than g if and only if that holds whenrestricted to a set of a finite cover, for all such sets.
49 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Zero-separation
Definition
OX (1) 6⊂ OX (0)
Intuition
There exists a function which scales worse than 0, but does notscale worse than 1.
50 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Zero-separation
Definition
OX (1) 6⊂ OX (0)
Intuition
There exists a function which scales worse than 0, but does notscale worse than 1.
51 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Zero-separation
Definition
OX (1) 6⊂ OX (0)
Intuition
There exists a function which scales worse than 0, but does notscale worse than 1.
52 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
One-separation
Definition
ON>0(n) 6⊂ ON>0(1)
Intuition
There exists a function which scales worse than 1, but does notscale worse than n.
53 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
One-separation
Definition
ON>0(n) 6⊂ ON>0(1)
Intuition
There exists a function which scales worse than 1, but does notscale worse than n.
54 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
One-separation
Definition
ON>0(n) 6⊂ ON>0(1)
Intuition
There exists a function which scales worse than 1, but does notscale worse than n.
55 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Composition rule
Definition
OX (f ) s ⊂ OY (f s) ∀f ∈ FX , s : Y → X .
Intuition
A function which does not scale worse than f , mapped through s,does not scale worse than f mapped through s.
56 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Composition rule
Definition
OX (f ) s ⊂ OY (f s) ∀f ∈ FX , s : Y → X .
Intuition
A function which does not scale worse than f , mapped through s,does not scale worse than f mapped through s.
57 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Composition rule
Definition
OX (f ) s ⊂ OY (f s) ∀f ∈ FX , s : Y → X .
Intuition
A function which does not scale worse than f , mapped through s,does not scale worse than f mapped through s.
58 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Uniqueness and existence
Primitive properties
The given properties are called the primitive properties.
Existence
There exists a function O with the primitive properties.
Uniqueness
There exists at most one function O with the primitive properties.
Explicit definition
f ∈ OX (g) :⇔ ∃c ∈ R>0 : f ≤ cg
59 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Uniqueness and existence
Primitive properties
The given properties are called the primitive properties.
Existence
There exists a function O with the primitive properties.
Uniqueness
There exists at most one function O with the primitive properties.
Explicit definition
f ∈ OX (g) :⇔ ∃c ∈ R>0 : f ≤ cg
60 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Uniqueness and existence
Primitive properties
The given properties are called the primitive properties.
Existence
There exists a function O with the primitive properties.
Uniqueness
There exists at most one function O with the primitive properties.
Explicit definition
f ∈ OX (g) :⇔ ∃c ∈ R>0 : f ≤ cg
61 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Uniqueness and existence
Primitive properties
The given properties are called the primitive properties.
Existence
There exists a function O with the primitive properties.
Uniqueness
There exists at most one function O with the primitive properties.
Explicit definition
f ∈ OX (g) :⇔ ∃c ∈ R>0 : f ≤ cg
62 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionPrimitive propertiesUniqueness and existence
Uniqueness and existence
Primitive properties
The given properties are called the primitive properties.
Existence
There exists a function O with the primitive properties.
Uniqueness
There exists at most one function O with the primitive properties.
Explicit definition
f ∈ OX (g) :⇔ ∃c ∈ R>0 : f ≤ cg
63 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Prevailing definition
Definition
f ∈ OX (g) :⇔ ∃c ∈ R>0, y ∈ X : (f |X≥y ) ≤ c(g |X≥y )where X ⊂ Rd and d ∈ N.
Problem
Our definition is different to the prevailing definition, which hasbeen used for decades. Is there something wrong with theprevailing definition?
Solution
The prevailing definition fulfills all of the primitive properties,except for the composition rule!
64 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Prevailing definition
Definition
f ∈ OX (g) :⇔ ∃c ∈ R>0, y ∈ X : (f |X≥y ) ≤ c(g |X≥y )where X ⊂ Rd and d ∈ N.
Problem
Our definition is different to the prevailing definition, which hasbeen used for decades. Is there something wrong with theprevailing definition?
Solution
The prevailing definition fulfills all of the primitive properties,except for the composition rule!
65 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Prevailing definition
Definition
f ∈ OX (g) :⇔ ∃c ∈ R>0, y ∈ X : (f |X≥y ) ≤ c(g |X≥y )where X ⊂ Rd and d ∈ N.
Problem
Our definition is different to the prevailing definition, which hasbeen used for decades. Is there something wrong with theprevailing definition?
Solution
The prevailing definition fulfills all of the primitive properties,except for the composition rule!
66 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Prevailing definition
Definition
f ∈ OX (g) :⇔ ∃c ∈ R>0, y ∈ X : (f |X≥y ) ≤ c(g |X≥y )where X ⊂ Rd and d ∈ N.
Problem
Our definition is different to the prevailing definition, which hasbeen used for decades. Is there something wrong with theprevailing definition?
Solution
The prevailing definition fulfills all of the primitive properties,except for the composition rule!
67 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Fundamental
The composition rule is fundamental; without it the complexityanalysis of an algorithm cannot be approached by dividing it intoparts, and studying the complexity of each part.
68 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
An example of failure
Algorithm 1 An algorithm which takes as input (m, n) ∈ N2, andhas time-complexity ON2(1) according to the prevailing definition.
1: procedure constantComplexity(m, n)2: j ← 03: if m = 0 then4: for i ∈ [0, n] do5: j ← j + 16: end for7: end if8: return j9: end procedure
69 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
An example of failure
Algorithm 2 An algorithm which takes as input (m, n) ∈ N2, andhas time-complexity ON2(1) according to the prevailing definition.
1: procedure constantComplexity(m, n)2: j ← 03: if m = 0 then4: for i ∈ [0, n] do5: j ← j + 16: end for7: end if8: return j9: end procedure
70 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Algorithm 3 An algorithm which takes as input n ∈ N, and callsanother ON2(1) algorithm n times with varying arguments.
1: procedure basicAnalysis(n)2: for i ∈ [0, n) do3: constantComplexity(0, i)4: end for5: end procedure
Composition
Computed via the composition rule, the complexity of thisalgorithm is ON(n).
Substitution
Computed via substitution, the complexity of this algorithm isON(n2). A contradiction!
71 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Algorithm 4 An algorithm which takes as input n ∈ N, and callsanother ON2(1) algorithm n times with varying arguments.
1: procedure basicAnalysis(n)2: for i ∈ [0, n) do3: constantComplexity(0, i)4: end for5: end procedure
Composition
Computed via the composition rule, the complexity of thisalgorithm is ON(n).
Substitution
Computed via substitution, the complexity of this algorithm isON(n2). A contradiction!
72 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Algorithm 5 An algorithm which takes as input n ∈ N, and callsanother ON2(1) algorithm n times with varying arguments.
1: procedure basicAnalysis(n)2: for i ∈ [0, n) do3: constantComplexity(0, i)4: end for5: end procedure
Composition
Computed via the composition rule, the complexity of thisalgorithm is ON(n).
Substitution
Computed via substitution, the complexity of this algorithm isON(n2). A contradiction!
73 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Characterization of failure
Theorem (Asymptotic composition rule)
Let X ⊂ Rd1 , Y ⊂ Rd2 , and s : Y → X . The composition ruleholds for s under the prevailing definition if and only if
∀x∗ ∈ X : ∃y∗ ∈ Y : s(Y≥y∗) ⊂ X≥x
∗. (1)
Subset-sum
Since the subset-sum rule implies the composition rule, the formerdoes not hold for the prevailing definition either.
Subset-sum or composition
Actually, assuming the other properties, the composition rule andthe subset-sum rule are equivalent.
74 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Characterization of failure
Theorem (Asymptotic composition rule)
Let X ⊂ Rd1 , Y ⊂ Rd2 , and s : Y → X . The composition ruleholds for s under the prevailing definition if and only if
∀x∗ ∈ X : ∃y∗ ∈ Y : s(Y≥y∗) ⊂ X≥x
∗. (1)
Subset-sum
Since the subset-sum rule implies the composition rule, the formerdoes not hold for the prevailing definition either.
Subset-sum or composition
Actually, assuming the other properties, the composition rule andthe subset-sum rule are equivalent.
75 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Characterization of failure
Theorem (Asymptotic composition rule)
Let X ⊂ Rd1 , Y ⊂ Rd2 , and s : Y → X . The composition ruleholds for s under the prevailing definition if and only if
∀x∗ ∈ X : ∃y∗ ∈ Y : s(Y≥y∗) ⊂ X≥x
∗. (1)
Subset-sum
Since the subset-sum rule implies the composition rule, the formerdoes not hold for the prevailing definition either.
Subset-sum or composition
Actually, assuming the other properties, the composition rule andthe subset-sum rule are equivalent.
76 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
DefinitionAn example of failureCharacterization of failure
Characterization of failure
Theorem (Asymptotic composition rule)
Let X ⊂ Rd1 , Y ⊂ Rd2 , and s : Y → X . The composition ruleholds for s under the prevailing definition if and only if
∀x∗ ∈ X : ∃y∗ ∈ Y : s(Y≥y∗) ⊂ X≥x
∗. (1)
Subset-sum
Since the subset-sum rule implies the composition rule, the formerdoes not hold for the prevailing definition either.
Subset-sum or composition
Actually, assuming the other properties, the composition rule andthe subset-sum rule are equivalent.
77 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
78 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
79 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
80 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )
Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
81 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )
Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
82 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)
Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
83 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )
Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
84 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )
Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
85 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)
Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
86 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )
Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
87 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More properties
The following properties are implied by the primitive properties.
Implied properties
Monotonicity: OX (OX (f )) ⊃ OX (f )Idempotence: OX (OX (f )) = OX (f )Membership rule: f ∈ OX (g)⇔ OX (f ) ⊂ OX (g)Bounded translation-invariance:(∃β ∈ R>0 : f ≥ β)⇒ OX (f + α) = OX (f )Positive homogenuity: αOX (f ) = OX (αf )Positive power-homogenuity: OX (f )α = OX (f α)Additive consistency: uOX (f ) + vOX (f ) = (u + v)OX (f )Multiplicative consistency: OX (f )uOX (f )v = OX (f )u+v
88 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
89 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )
Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
90 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)
Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
91 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)
Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
92 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))
Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
93 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))
Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
94 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)
Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
95 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)
Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
96 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Implied properties
More implied properties
Maximum-consistency: max(OX (f ),OX (f )) = OX (f )Restriction rule: (OX (f )|D) = OD(f |D)Additivity: OX (f ) + OX (g) = OX (f + g)Maximum rule: max(OX (f ),OX (g)) = OX (max(f , g))Summation rule: OX (f + g) = OX (max(f , g))Maximum-sum rule: max(OX (f ),OX (g)) = OX (f ) + OX (g)Injective composition rule: OX (f ) s = OY (f s) (s injective)Subset-sum rule:f ∈ OY (g)⇒
(x 7→
∑y∈S(x) f (y)
)∈ OX
(∑y∈S(x) g(y)
)
97 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Prevailing definition
The prevailing definition fulfills all of the implied properties, exceptfor the subset-sum rule, and the injective composition rule.
98 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Relation definitions
Given the O-notation OX : FX → P(FX ), we define the relations,,≺,,≈ ⊂ (FX × FX ) such that
g f ⇔ g ∈ OX (f ),
g f ⇔ f ∈ OX (g),
g ≺ f ⇔ f 6∈ OX (g) and g ∈ OX (f ),
g f ⇔ f ∈ OX (g) and g 6∈ OX (f ),
g ≈ f ⇔ f ∈ OX (g) and g ∈ OX (f ),
(2)
for all f , g ∈ FX .
99 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
Relation definitions
Using these relations, we define the traditional related notationsΩX , oX , ωX ,ΘX : FX → P(FX ) such that
ΩX (f ) := g ∈ FX : g f ,oX (f ) := g ∈ FX : g ≺ f ,ωX (f ) := g ∈ FX : g f ,ΘX (f ) := g ∈ FX : g ≈ f ,
(3)
for all f ∈ FX .
100 / 101
Algorithm analysisO-notation
Prevailing definitionImplied properties
The end. Questions? :)
101 / 101