Presentation is loading. Please wait.

Presentation is loading. Please wait.

Growth of function 2008. 1. 28 : 1 Chapter 3. Growth of function.

Similar presentations


Presentation on theme: "Growth of function 2008. 1. 28 : 1 Chapter 3. Growth of function."— Presentation transcript:

1 Growth of function : 1 Chapter 3. Growth of function

2 Contents of Table 1.Asymptotic notation O-notation Ω-notation Θ-notation 2.Asymptotically lager/smaller notation o-notation ω-notation 3. Relationship between this notations 2

3 Asymptotic notation - Which one is better algorithm for enough inputs? we are studing asymptotic efficiency of algorithms ( size of the input in the limit, as the size of the inputs increases without bound. ) 3 1. Asymptotic notation

4 O-notation Asymptotically upper bound - Definition for all n, n n 0, 0 f(n) c g(n), the function f(n) is smaller or equal to g(n) to within constant factor Asymptotic notation g(n) is asymptotically upper bound for f(n)

5 O-notation - Definition O(g(n)) = { f(n) : there exist positive constant c and n 0 such that 0 f(n) c g(n) for all n n 0 } 5 1. Asymptotic notation f(n) cg(n) n0n0 n

6 O-notation - f(n) = O(g(n)) means f(n) O(g(n)) - means f(n) = θ(g(n)) implies f(n) = O(g(n)). since θ-notation stronger notation than O-notation 6 1. Asymptotic notation O(g(n)) f(n)f(n)

7 O-notation Example, ( ) Use the definition of O-notation to prove the following property., ( ) Use the definition of O-notation to prove the following property. 1. Asymptotic notation

8 O-notation Solution to example To show that, we need to find c and n 0 For maximize value of, we make n 0 = 1 Thus, c=a+\b\ and, n 0 = 1 (because c is positive contant) 1. Asymptotic notation

9 Ω -notation Asymptotically lower bound - Definition for all n, n n 0, 0 c g(n) f(n), the function f(n) is larger or equal to g(n) to within constant factor Asymptotic notation g(n) is asymptotically lower bound for f(n)

10 Ω -notation - Definition Ω (g(n)) = { f(n) : there exist positive constant c and n 0 such that 0 c g(n) f(n) for all n n 0 } Asymptotic notation n0n0 cg(n) f(n) n

11 g(n) is asymptotically tight bound for f(n) θ-notation Asymptotically tight bound - Definition for all n, n n 0, 0 c 1 g(n) f(n) c 2 g(n), the function f(n) is equal to g(n) to within constant factor Asymptotic notation

12 θ-notation - Definition θ(g(n)) = { f(n) : there exist positive constant c 1, c 2 and n 0 such that 0 c 1 g(n) f(n) c 2 g(n) for all n n 0 } Asymptotic notation c 1 g(n) n0n0 f(n) c 2 g(n) n

13 θ-notation - f(n) = θ(g(n)) means f(n) Θ(g(n)) - Definition of θ(g(n)) requires that every member f(n) Θ(g(n)) be asymptotically nonnegative (=asymptotically positive) Asymptotic notation θ(g(n)) f(n)f(n) f(n) n0n0

14 θ-notation Example 1. Asymptotic notation, Use the definition of θ-notation to prove the following property., Use the definition of θ-notation to prove the following property.

15 θ-notation Solution to example 1. Asymptotic notation When n 0 =6 then c 1 0 c 1 need to be positive constant so n 0 =6 is wrong. When n 0 =7 then c 1 1/14 ( n 0 =7) When n 0 =1 then 1/2 (n 0 =1) thus, ( n 0 =7)

16 θ-notation Example 1. Asymptotic notation, Use the definition of θ-notation to prove the following property., Use the definition of θ-notation to prove the following property.

17 Thus, θ-notation Solution to example To show that, we need to find c 1, c 2 and n 0 so, 1. Asymptotic notation the more value of n is larger, the more value of is smaller So, value of will be smaller than 6.

18 Theorem 3.1 Relationship Asymptotic notation For any two functions f(n) and g(n), we have f(n) = Θ(g(n)) if and only if f(n) = O(g(n)) and f(n) = (g(n)). θ(g(n)) O(g(n))Ω(g(n))

19 19 1. Asymptotic notation Asymptotic notation in equations and inequalities - Stands alone on the right-hand side of an equation equal sign to mean set membership n O(n 2 ) equal sign to mean set membership n O(n 2 )

20 20 1. Asymptotic notation Asymptotic notation in equations and inequalities - Asymptotic notation appears in a formula interpret is as standing for some anonymous function f(n) Θ(n) interpret is as standing for some anonymous function f(n) Θ(n)

21 21 1. Asymptotic notation Asymptotic notation in equations and inequalities - Asymptotic notation appears in a formula There is no point in specifying all lower-order terms exactly Eliminate inessential detail and clutter

22 22 1. Asymptotic notation Asymptotic notation in equations and inequalities - Number of anonymous functions Number of anonymous functions Number of times the asymptotic notation

23 23 1. Asymptotic notation Asymptotic notation in equations and inequalities - Asymptotic notation appears in left-hand side of an equation right-hand side of an equation provides a coarser level of detail than the left-hand side. There is a way to choose the anonymous functions on the right of the equal sign to make the equation valid.

24 24 1. Asymptotic notation Asymptotic notation in equations and inequalities - A number of such relationships can be chained together f(n) Θ(n) g(n) Θ(n) h(n) Θ (n 2 )

25 f(n) is asymptotically smaller than g(n) o -notation Asymptotically smaller - Definition for all n, n n 0, any positive constant c, c>0, 0 f(n)< cg(n), the function f(n) is smaller to g(n) to within constant factor Asymptotically larger/smaller notation

26 26 2. Asymptotically larger/smaller notation o -notation - Definition o(g(n)) = { f(n) : for any positive constant c>0, there exist a constant n 0 >0 such that 0 f(n) < cg(n) for all n n 0 } f(n) o(g(n)) n0n0

27 o -notation - We use o-notation to denote an upper bound that is not asymptotically tight. - this limit shows the function f(n) becomes insignificant relative to g(n) as n approaches infinity Asymptotically larger/smaller notation

28 o -notation Example 1. Asymptotic notation Use the definition of o-notation to prove the following property. f(n) = o(n 2 ) Use the definition of o-notation to prove the following property. f(n) = o(n 2 )

29 29 2. Asymptotically larger/smaller notation o -notation Solution to example 2n = o(n 2 ) If f(n) = o((g(n)) then

30 f(n) is asymptotically larger than g(n) ω -notation Asymptotically larger - Definition for all n, n n 0, any positive constant c, c>0, 0 cg(n) < f(n), the function f(n) is larger to g(n) to within constant factor Asymptotically larger/smaller notation

31 31 2. Asymptotically larger/smaller notation ω -notation - Definition ω(g(n)) = { f(n) : for any positive constant c>0, there exist a constant n 0 >0 such that 0 cg(n) < f(n) for all n n 0 } f(n) ω(g(n))

32 ω -notation - We use ω-notation to denote a lower bound that is not asymptotically tight. - f(n) ω(g(n)) if and only if g(n) o(f(n)). - if the limit exists. That is, f(n) becomes arbitrarily large relative to g(n) as n approaches infinity Asymptotically larger/smaller notation

33 33 2. Asymptotically larger/smaller notation ω -notation Example Use the definition of o-notation to prove the following property. f(n) = ω(n) Use the definition of o-notation to prove the following property. f(n) = ω(n)

34 34 2. Asymptotically larger/smaller notation ω -notation Solution to example =ω(n) If f(n) = ω((g(n)) then

35 35 3. Relationship between this notations f(n) O(g(n)) o(g(n)) ω(g(n)) Ω(g(n)) θ(g(n)) O(g(n))Ω(g(n)) ω(g(n)) o(g(n))

36 36 3. Relationship between this notations f(n) O(g(n)) o(g(n)) ω(g(n)) Ω(g(n)) Transitivity Transpose symmetry f(n) = Θ(g(n)) and g(n) = Θ(h(n)) imply f(n) = Θ(h(n)), f(n) = O(g(n)) and g(n) = O(h(n)) imply f(n) = O(h(n)), f(n) = (g(n)) and g(n) = (h(n)) imply f(n) = (h(n)), f(n) = o(g(n)) and g(n) = o(h(n)) imply f(n) = o(h(n)), f(n) = ω(g(n)) and g(n) = ω(h(n)) imply f(n) = ω(h(n)). f(n) = O(g(n)) if and only if g(n) = (f(n)), f(n) = o(g(n)) if and only if g(n) = ω(f(n)).

37 37 3. Relationship between this notations Reflexivity f(n) = Θ(f(n)) f(n) = O(f(n)) f(n) = (f(n)) Symmetry f(n) = Θ(g(n)) if and only if g(n) = Θ(f(n)). θ(g(n)) O(g(n))Ω(g(n))

38 38 4. Question and Answer Q&AQ&A


Download ppt "Growth of function 2008. 1. 28 : 1 Chapter 3. Growth of function."

Similar presentations


Ads by Google