You are on page 1of 7

Design and

Analysis of
Algorithms
Lecture 07

Dr. Muhammad Umair

09/03/2015

Mathematical Representation

- Notation (Theta)

(g(n)) = { f(n) : such that 0 <= c1 g(n) <= f(n) <= c2 g(n) }

Where c1, c2 are positive constant and n0 <= n

Dr. Muhammad Umair

09/03/20
15

Mathematical Representation

O Notation (Big- Oh)

O (g(n)) = { f(n) : such that 0 <= f(n) <= c g(n) }

Where c is positive constant and n0 <= n

Dr. Muhammad Umair

09/03/20
15

Mathematical Representation

- Notation (Omega)

(g(n)) = { f(n) : such that 0 <= c g(n) <= f(n) }

Where c is positive constant and n0 <= n

Dr. Muhammad Umair

09/03/20
15

Example

Dr. Muhammad Umair

n 3n
2

09/03/20
15

Example

f(n) = an2 + bn + c

Dr. Muhammad Umair

09/03/20
15

Class Exercises

(3/2) n2 - 4n = (n2)

6n3 = (n2)

2n+1 = O(2n)

22n = O(2n)

d nlgn dn(lg 3 2/3) + cn <= d(nlgn)

(3/16) d n2 + cn2 <= d(n2)

Dr. Muhammad Umair

09/03/20
15

You might also like