A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition...

101
Algorithm analysis O-notation Prevailing definition Implied properties A general definition of the big oh notation for algorithm analysis Kalle Rutanen Department of Mathematics Tampere University of Technology June 3, 2014 1 / 101

Transcript of A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition...

Page 1: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 2: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 3: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 4: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 5: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 6: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 7: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 8: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 9: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 10: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 11: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 12: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 13: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 14: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 15: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 16: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 17: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 18: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 19: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 20: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 21: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 22: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 23: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 24: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 25: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 26: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 27: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 28: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 29: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 30: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 31: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 32: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 33: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 34: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 35: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 36: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 37: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 38: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 39: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 40: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 41: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 42: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 43: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 44: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 45: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 46: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 47: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 48: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 49: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 50: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 51: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 52: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 53: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 54: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 55: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 56: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 57: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 58: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 59: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 60: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 61: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 62: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 63: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 64: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 65: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 66: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 67: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 68: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 69: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 70: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 71: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 72: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 73: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 74: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 75: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 76: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 77: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 78: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 79: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 80: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 81: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 82: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 83: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 84: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 85: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 86: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 87: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 88: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 89: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 90: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 91: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 92: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 93: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 94: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 95: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 96: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 97: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 98: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 99: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 100: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

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

Page 101: A general definition of the big oh notation for algorithm ... · O-notation Prevailing de nition Implied properties A general de nition of the big oh notation for algorithm analysis

Algorithm analysisO-notation

Prevailing definitionImplied properties

The end. Questions? :)

101 / 101