SlideShare uma empresa Scribd logo
1 de 57
Baixar para ler offline
Introduction to Algorithms
                           6.046J/18.401J
                                     LECTURE 2
                                     Asymptotic Notation
                                     • O-, -, and -notation
                                     Recurrences
                                     • Substitution method
                                     • Iterating the recurrence
                                     • Recursion tree
                                     • Master method
                       Prof. Erik Demaine
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.1
Asymptotic notation
 O-notation (upper bounds):
       We write f(n) = O(g(n)) if there
       exist constants c > 0, n0 > 0 such
       that 0  f(n)  cg(n) for all n  n0.




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.2
Asymptotic notation
 O-notation (upper bounds):
       We write f(n) = O(g(n)) if there
       exist constants c > 0, n0 > 0 such
       that 0  f(n)  cg(n) for all n  n0.

EXAMPLE: 2n2 = O(n3)                                      (c = 1, n0 = 2)


September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.3
Asymptotic notation
 O-notation (upper bounds):
       We write f(n) = O(g(n)) if there
       exist constants c > 0, n0 > 0 such
       that 0  f(n)  cg(n) for all n  n0.

EXAMPLE: 2n2 = O(n3)                                      (c = 1, n0 = 2)

           functions,
           not values
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.4
Asymptotic notation
 O-notation (upper bounds):
       We write f(n) = O(g(n)) if there
       exist constants c > 0, n0 > 0 such
       that 0  f(n)  cg(n) for all n  n0.

EXAMPLE: 2n2 = O(n3)                                      (c = 1, n0 = 2)
                                                           funny, “one-way”
           functions,                                      equality
           not values
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.5
Set definition of O-notation
   O(g(n)) = { f(n) : there exist constants
                      c > 0, n0 > 0 such
                      that 0  f(n)  cg(n)
                      for all n  n0 }




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.6
Set definition of O-notation
   O(g(n)) = { f(n) : there exist constants
                      c > 0, n0 > 0 such
                      that 0  f(n)  cg(n)
                      for all n  n0 }

EXAMPLE: 2n2  O(n3)



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.7
Set definition of O-notation
   O(g(n)) = { f(n) : there exist constants
                      c > 0, n0 > 0 such
                      that 0  f(n)  cg(n)
                      for all n  n0 }

EXAMPLE: 2n2  O(n3)
(Logicians: n.2n2  O(n.n3), but it’s
convenient to be sloppy, as long as we
understand what’s really going on.)
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.8
Macro substitution
Convention: A set in a formula represents
an anonymous function in the set.




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.9
Macro substitution
Convention: A set in a formula represents
an anonymous function in the set.
EXAMPLE:                 f(n) = n3 + O(n2)
                         means
                         f(n) = n3 + h(n)
                         for some h(n)  O(n2) .


September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.10
Macro substitution
Convention: A set in a formula represents
an anonymous function in the set.
EXAMPLE:                 n2 + O(n) = O(n2)
                         means
                         for any f(n)  O(n):
                              n2 + f(n) = h(n)
                              for some h(n)  O(n2) .

September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.11
-notation (lower bounds)
O-notation is an upper-bound notation. It
makes no sense to say f(n) is at least O(n2).




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.12
-notation (lower bounds)
O-notation is an upper-bound notation. It
makes no sense to say f(n) is at least O(n2).

    g(n)) = { f(n) : there exist constants
                      c > 0, n0 > 0 such
                      that 0  cg(n)  f(n)
                      for all n  n0 }


September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.13
-notation (lower bounds)
O-notation is an upper-bound notation. It
makes no sense to say f(n) is at least O(n2).

    g(n)) = { f(n) : there exist constants
                      c > 0, n0 > 0 such
                      that 0  cg(n)  f(n)
                      for all n  n0 }

 EXAMPLE:                   n  (lg n) (c = 1, n0 = 16)
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.14
-notation (tight bounds)

              g(n)) = O(g(n))  (g(n))




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.15
-notation (tight bounds)

              g(n)) = O(g(n))  (g(n))

                            1     2                            2
   EXAMPLE:                 2
                                n  2 n  ( n )




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.16
-notation and -notation
O-notation and -notation are like  and .
o-notation and -notation are like < and >.

     g(n)) = { f(n) : for any constant c > 0,
                      there is a constant n0 > 0
                      such that 0  f(n) cg(n)
                      for all n  n0 }

 EXAMPLE: 2n2 = o(n3)                                      (n0 = 2/c)
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.17
-notation and -notation
O-notation and -notation are like  and .
o-notation and -notation are like < and >.

 g(n)) = { f(n) : for any constant c > 0,
                                      there is a constant n0 > 0
                                      such that 0  cg(n) f(n)
                                      for all n  n0 }

 EXAMPLE:                   n   (lg n)                   (n0 = 1+1/c)
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.18
Solving recurrences
  • The analysis of merge sort from Lecture 1
    required us to solve a recurrence.
  • Recurrences are like solving integrals,
    differential equations, etc.
       Learn a few tricks.
  • Lecture 3: Applications of recurrences to
    divide-and-conquer algorithms.



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.19
Substitution method
  The most general method:
  1. Guess the form of the solution.
  2. Verify by induction.
  3. Solve for constants.




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.20
Substitution method
  The most general method:
  1. Guess the form of the solution.
  2. Verify by induction.
  3. Solve for constants.
  EXAMPLE: T(n) = 4T(n/2) + n
  • [Assume that T(1) = (1).]
  • Guess O(n3) . (Prove O and separately.)
  • Assume that T(k)  ck3 for k < n .
  • Prove T(n)  cn3 by induction.
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.21
Example of substitution
T (n)  4T (n / 2)  n
       4c(n / 2)3  n
       (c / 2)n3  n
       cn3  ((c / 2)n3  n)   desired – residual
       cn3 desired
whenever (c/2)n3 – n  0, for
example, if c  2 and n  1.
                         residual

September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.22
Example (continued)
 • We must also handle the initial conditions,
   that is, ground the induction with base
   cases.
 • Base: T(n) = (1) for all n < n0, where n0
   is a suitable constant.
 • For 1  n < n0, we have “ (1)”  cn3, if we
   pick c big enough.



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.23
Example (continued)
 • We must also handle the initial conditions,
   that is, ground the induction with base
   cases.
 • Base: T(n) = (1) for all n < n0, where n0
   is a suitable constant.
 • For 1  n < n0, we have “ (1)”  cn3, if we
   pick c big enough.

                     This bound is not tight!
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.24
A tighter upper bound?
We shall prove that T(n) = O(n2).




September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.25
A tighter upper bound?
We shall prove that T(n) = O(n2).
Assume that T(k)  ck2 for k < n:
T (n)  4T (n / 2)  n
       4c ( n / 2) 2  n
       cn 2  n
              2
       O(n )



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.26
A tighter upper bound?
We shall prove that T(n) = O(n2).
Assume that T(k)  ck2 for k < n:
T (n)  4T (n / 2)  n
       4c ( n / 2) 2  n
       cn 2  n
              2
       O(n ) Wrong! We must prove the I.H.



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.27
A tighter upper bound?
We shall prove that T(n) = O(n2).
Assume that T(k)  ck2 for k < n:
T (n)  4T (n / 2)  n
       4c ( n / 2) 2  n
       cn 2  n
              2
       O(n ) Wrong! We must prove the I.H.
       cn 2  ( n) [ desired – residual ]
       cn 2 for no choice of c > 0. Lose!
September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.28
A tighter upper bound!
IDEA: Strengthen the inductive hypothesis.
• Subtract a low-order term.
Inductive hypothesis: T(k)  c1k2 – c2k for k < n.




  September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.29
A tighter upper bound!
IDEA: Strengthen the inductive hypothesis.
• Subtract a low-order term.
Inductive hypothesis: T(k)  c1k2 – c2k for k < n.
          T(n) = 4T(n/2) + n
               = 4(c1(n/2)2 – c2(n/2)) + n
               = c1n2 – 2c2n + n
               = c1n2 – c2n – (c2n – n)
                c1n2 – c2n if c2  1.

  September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.30
A tighter upper bound!
IDEA: Strengthen the inductive hypothesis.
• Subtract a low-order term.
Inductive hypothesis: T(k)  c1k2 – c2k for k < n.
          T(n) = 4T(n/2) + n
               = 4(c1(n/2)2 – c2(n/2)) + n
               = c1n2 – 2c2n + n
               = c1n2 – c2n – (c2n – n)
                c1n2 – c2n if c2  1.
Pick c1 big enough to handle the initial conditions.
  September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.31
Recursion-tree method
• A recursion tree models the costs (time) of a
  recursive execution of an algorithm.
• The recursion-tree method can be unreliable,
  just like any method that uses ellipses (…).
• The recursion-tree method promotes intuition,
  however.
• The recursion tree method is good for
  generating guesses for the substitution method.

September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.32
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.33
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                                T(n)




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.34
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2
            T(n/4)                                T(n/2)




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.35
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2
             (n/4)2                                 (n/2)2

 T(n/16)              T(n/8)            T(n/8)               T(n/4)




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.36
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2
             (n/4)2                                 (n/2)2

  (n/16)2             (n/8)2             (n/8)2               (n/4)2


   (1)

 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.37
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2                                                                  n2
             (n/4)2                                 (n/2)2

  (n/16)2             (n/8)2             (n/8)2               (n/4)2


   (1)

 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.38
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2                                                                   n2
                                                                                     5 n2
             (n/4)2                                 (n/2)2
                                                                                    16
  (n/16)2             (n/8)2             (n/8)2               (n/4)2


   (1)

 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson    L2.39
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2                                                                    n2
                                                                                       5 n2
             (n/4)2                                 (n/2)2
                                                                                      16
                                                                                     25 n 2
  (n/16)2             (n/8)2             (n/8)2               (n/4)2
                                                                                    256




                                                                                      …
   (1)

 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson     L2.40
Example of recursion tree
Solve T(n) = T(n/4) + T(n/2) + n2:
                   n2                                                                      n2
                                                                                        5 n2
             (n/4)2                                 (n/2)2
                                                                                       16
                                                                                      25 n 2
  (n/16)2             (n/8)2             (n/8)2               (n/4)2
                                                                                     256




                                                                                       …
   (1)                      Total = n           2
                                                        5  5 2
                                                    1  16 16                 5 3
                                                                                    16
                                                                                                
                                  = (n2)                        geometric series
 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson      L2.41
The master method

The master method applies to recurrences of
the form
                     T(n) = a T(n/b) + f (n) ,
where a  1, b > 1, and f is asymptotically
positive.



September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.42
Three common cases
Compare f (n) with nlogba:
1. f (n) = O(nlogba – ) for some constant > 0.
   • f (n) grows polynomially slower than nlogba
     (by an n factor).
   Solution: T(n) = (nlogba) .




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.43
Three common cases
Compare f (n) with nlogba:
1. f (n) = O(nlogba – ) for some constant > 0.
   • f (n) grows polynomially slower than nlogba
     (by an n factor).
   Solution: T(n) = (nlogba) .
2. f (n) = (nlogba lgkn) for some constant k  0.
   • f (n) and nlogba grow at similar rates.
   Solution: T(n) = (nlogba lgk+1n) .
 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.44
Three common cases (cont.)
Compare f (n) with nlogba:
3. f (n) = (nlogba + ) for some constant > 0.
   • f (n) grows polynomially faster than nlogba (by
     an n factor),
   and f (n) satisfies the regularity condition that
   a f (n/b)  c f (n) for some constant c < 1.
   Solution: T(n) = ( f (n)) .


 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.45
Examples

EX. T(n) = 4T(n/2) + n
    a = 4, b = 2  nlogba = n2; f (n) = n.
    CASE 1: f (n) = O(n2 – ) for = 1.
     T(n) = (n2).




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.46
Examples

EX. T(n) = 4T(n/2) + n
    a = 4, b = 2  nlogba = n2; f (n) = n.
    CASE 1: f (n) = O(n2 – ) for = 1.
     T(n) = (n2).

EX. T(n) = 4T(n/2) + n2
    a = 4, b = 2  nlogba = n2; f (n) = n2.
    CASE 2: f (n) = (n2lg0n), that is, k = 0.
     T(n) = (n2lg n).

 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.47
Examples
EX. T(n) = 4T(n/2) + n3
    a = 4, b = 2  nlogba = n2; f (n) = n3.
    CASE 3: f (n) = (n2 + ) for = 1
    and 4(n/2)3  cn3 (reg. cond.) for c = 1/2.
     T(n) = (n3).




 September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.48
Examples
EX. T(n) = 4T(n/2) + n3
    a = 4, b = 2  nlogba = n2; f (n) = n3.
    CASE 3: f (n) = (n2 + ) for = 1
    and 4(n/2)3  cn3 (reg. cond.) for c = 1/2.
     T(n) = (n3).
EX. T(n) = 4T(n/2) + n2/lg n
    a = 4, b = 2  nlogba = n2; f (n) = n2/lg n.
    Master method does not apply. In particular,
    for every constant > 0, we have n            (lg n).
  September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.49
Idea of master theorem
     Recursion tree:
                              a        f (n)
            f (n/b) f (n/b) … f (n/b)
                       a
   f (n/b2) f (n/b2) … f (n/b2)


      (1)

September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson   L2.50
Idea of master theorem
     Recursion tree:
                                       f (n)                                          f (n)
                              a
            f (n/b) f (n/b) … f (n/b)                                               a f (n/b)
                       a
   f (n/b2) f (n/b2) … f (n/b2)                                                    a2 f (n/b2)




                                                                                     …
      (1)

September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.51
Idea of master theorem
        Recursion tree:
                                          f (n)                                          f (n)
                                  a
                f (n/b) f (n/b) … f (n/b)                                              a f (n/b)
h = logbn                  a
       f (n/b2) f (n/b2) … f (n/b2)                                                   a2 f (n/b2)




                                                                                        …
         (1)

   September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.52
Idea of master theorem
        Recursion tree:
                                          f (n)                                          f (n)
                                  a
                f (n/b) f (n/b) … f (n/b)                                              a f (n/b)
h = logbn                  a
       f (n/b2) f (n/b2) … f (n/b2)                                                   a2 f (n/b2)

                                   #leaves = ah




                                                                                        …
         (1)                               = alogbn                                   nlogba (1)
                                           = nlogba

   September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.53
Idea of master theorem
        Recursion tree:
                                          f (n)                                          f (n)
                                  a
                f (n/b) f (n/b) … f (n/b)                                              a f (n/b)
h = logbn                  a
       f (n/b2) f (n/b2) … f (n/b2)                                                   a2 f (n/b2)

             CASE 1: The weight increases




                                                                                        …
             geometrically from the root to the
         (1) leaves. The leaves hold a constant                                       nlogba (1)
             fraction of the total weight.
                                                                                        (nlogba)
   September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.54
Idea of master theorem
        Recursion tree:
                                            f (n)                                          f (n)
                                  a
                f (n/b) f (n/b) … f (n/b)                                                a f (n/b)
h = logbn                  a
       f (n/b2) f (n/b2) … f (n/b2)                                                     a2 f (n/b2)




                                                                                          …
                        CASE 2: (k = 0) The weight
         (1)            is approximately the same on                                    nlogba (1)
                        each of the logbn levels.
                                                                                        (nlogbalg n)
   September 12, 2005     Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.55
Idea of master theorem
        Recursion tree:
                                          f (n)                                          f (n)
                                  a
                f (n/b) f (n/b) … f (n/b)                                              a f (n/b)
h = logbn                  a
       f (n/b2) f (n/b2) … f (n/b2)                                                   a2 f (n/b2)

             CASE 3: The weight decreases




                                                                                        …
             geometrically from the root to the
         (1) leaves. The root holds a constant                                        nlogba (1)
             fraction of the total weight.
                                                                                        ( f (n))
   September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson       L2.56
Appendix: geometric series

                             1  x n 1
       1  x  x2    xn             for x  1
                               1 x
                            1
                            2
             1 x  x        for |x| < 1
                           1 x

                                                                     Return to last
                                                                     slide viewed.


September 12, 2005   Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson      L2.57

Mais conteúdo relacionado

Mais procurados

Proof of Kraft-McMillan theorem
Proof of Kraft-McMillan theoremProof of Kraft-McMillan theorem
Proof of Kraft-McMillan theoremVu Hung Nguyen
 
Fractional Calculus A Commutative Method on Real Analytic Functions
Fractional Calculus A Commutative Method on Real Analytic FunctionsFractional Calculus A Commutative Method on Real Analytic Functions
Fractional Calculus A Commutative Method on Real Analytic FunctionsMatt Parker
 
Kernel for Chordal Vertex Deletion
Kernel for Chordal Vertex DeletionKernel for Chordal Vertex Deletion
Kernel for Chordal Vertex DeletionAkankshaAgrawal55
 
Some Examples of Scaling Sets
Some Examples of Scaling SetsSome Examples of Scaling Sets
Some Examples of Scaling SetsVjekoslavKovac1
 
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...VjekoslavKovac1
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Traian Rebedea
 
A sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsA sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsVjekoslavKovac1
 
InvolveSubmission
InvolveSubmissionInvolveSubmission
InvolveSubmissionJohn Norton
 
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...SEENET-MTP
 
Matrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsMatrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsUtrecht University
 
Boundedness of the Twisted Paraproduct
Boundedness of the Twisted ParaproductBoundedness of the Twisted Paraproduct
Boundedness of the Twisted ParaproductVjekoslavKovac1
 
The Exponential Time Hypothesis
The Exponential Time HypothesisThe Exponential Time Hypothesis
The Exponential Time HypothesisASPAK2014
 
Transport coefficients of QGP in strong magnetic fields
Transport coefficients of QGP in strong magnetic fieldsTransport coefficients of QGP in strong magnetic fields
Transport coefficients of QGP in strong magnetic fieldsDaisuke Satow
 
On Twisted Paraproducts and some other Multilinear Singular Integrals
On Twisted Paraproducts and some other Multilinear Singular IntegralsOn Twisted Paraproducts and some other Multilinear Singular Integrals
On Twisted Paraproducts and some other Multilinear Singular IntegralsVjekoslavKovac1
 
Fine Grained Complexity of Rainbow Coloring and its Variants
Fine Grained Complexity of Rainbow Coloring and its VariantsFine Grained Complexity of Rainbow Coloring and its Variants
Fine Grained Complexity of Rainbow Coloring and its VariantsAkankshaAgrawal55
 
Norm-variation of bilinear averages
Norm-variation of bilinear averagesNorm-variation of bilinear averages
Norm-variation of bilinear averagesVjekoslavKovac1
 

Mais procurados (20)

Proof of Kraft-McMillan theorem
Proof of Kraft-McMillan theoremProof of Kraft-McMillan theorem
Proof of Kraft-McMillan theorem
 
Fractional Calculus A Commutative Method on Real Analytic Functions
Fractional Calculus A Commutative Method on Real Analytic FunctionsFractional Calculus A Commutative Method on Real Analytic Functions
Fractional Calculus A Commutative Method on Real Analytic Functions
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
 
Kernel for Chordal Vertex Deletion
Kernel for Chordal Vertex DeletionKernel for Chordal Vertex Deletion
Kernel for Chordal Vertex Deletion
 
Some Examples of Scaling Sets
Some Examples of Scaling SetsSome Examples of Scaling Sets
Some Examples of Scaling Sets
 
Crystallographic groups
Crystallographic groupsCrystallographic groups
Crystallographic groups
 
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...
Variants of the Christ-Kiselev lemma and an application to the maximal Fourie...
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10
 
draft5
draft5draft5
draft5
 
A sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsA sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentials
 
InvolveSubmission
InvolveSubmissionInvolveSubmission
InvolveSubmission
 
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...
D. Vulcanov - On Cosmologies with non-Minimally Coupled Scalar Field and the ...
 
Matrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial BackgroundsMatrix Models of 2D String Theory in Non-trivial Backgrounds
Matrix Models of 2D String Theory in Non-trivial Backgrounds
 
Boundedness of the Twisted Paraproduct
Boundedness of the Twisted ParaproductBoundedness of the Twisted Paraproduct
Boundedness of the Twisted Paraproduct
 
LPS talk notes
LPS talk notesLPS talk notes
LPS talk notes
 
The Exponential Time Hypothesis
The Exponential Time HypothesisThe Exponential Time Hypothesis
The Exponential Time Hypothesis
 
Transport coefficients of QGP in strong magnetic fields
Transport coefficients of QGP in strong magnetic fieldsTransport coefficients of QGP in strong magnetic fields
Transport coefficients of QGP in strong magnetic fields
 
On Twisted Paraproducts and some other Multilinear Singular Integrals
On Twisted Paraproducts and some other Multilinear Singular IntegralsOn Twisted Paraproducts and some other Multilinear Singular Integrals
On Twisted Paraproducts and some other Multilinear Singular Integrals
 
Fine Grained Complexity of Rainbow Coloring and its Variants
Fine Grained Complexity of Rainbow Coloring and its VariantsFine Grained Complexity of Rainbow Coloring and its Variants
Fine Grained Complexity of Rainbow Coloring and its Variants
 
Norm-variation of bilinear averages
Norm-variation of bilinear averagesNorm-variation of bilinear averages
Norm-variation of bilinear averages
 

Destaque

Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Complexity analysis - The Big O Notation
Complexity analysis - The Big O NotationComplexity analysis - The Big O Notation
Complexity analysis - The Big O NotationJawad Khan
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notationirdginfo
 
Multimedia lecture ActionScript3
Multimedia lecture ActionScript3Multimedia lecture ActionScript3
Multimedia lecture ActionScript3Mohammed Hussein
 
Whizle For Learners
Whizle For LearnersWhizle For Learners
Whizle For Learnershumanist3
 
02 greedy, d&c, binary search
02 greedy, d&c, binary search02 greedy, d&c, binary search
02 greedy, d&c, binary searchPankaj Prateek
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationAmrinder Arora
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsEhtisham Ali
 
02 Analysis of Algorithms: Divide and Conquer
02 Analysis of Algorithms: Divide and Conquer02 Analysis of Algorithms: Divide and Conquer
02 Analysis of Algorithms: Divide and ConquerAndres Mendez-Vazquez
 
Iteration, induction, and recursion
Iteration, induction, and recursionIteration, induction, and recursion
Iteration, induction, and recursionMohammed Hussein
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 

Destaque (20)

Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Complexity analysis - The Big O Notation
Complexity analysis - The Big O NotationComplexity analysis - The Big O Notation
Complexity analysis - The Big O Notation
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Big o notation
Big o notationBig o notation
Big o notation
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Lec3 Algott
Lec3 AlgottLec3 Algott
Lec3 Algott
 
Multimedia lecture ActionScript3
Multimedia lecture ActionScript3Multimedia lecture ActionScript3
Multimedia lecture ActionScript3
 
Whizle For Learners
Whizle For LearnersWhizle For Learners
Whizle For Learners
 
Multimedia lecture6
Multimedia lecture6Multimedia lecture6
Multimedia lecture6
 
Wireless lecture1
Wireless lecture1Wireless lecture1
Wireless lecture1
 
02 greedy, d&c, binary search
02 greedy, d&c, binary search02 greedy, d&c, binary search
02 greedy, d&c, binary search
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
02 Analysis of Algorithms: Divide and Conquer
02 Analysis of Algorithms: Divide and Conquer02 Analysis of Algorithms: Divide and Conquer
02 Analysis of Algorithms: Divide and Conquer
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Iteration, induction, and recursion
Iteration, induction, and recursionIteration, induction, and recursion
Iteration, induction, and recursion
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
 
Comnet Network Simulation
Comnet Network SimulationComnet Network Simulation
Comnet Network Simulation
 
PHP
 PHP PHP
PHP
 

Semelhante a 02 asymptotic-notation-and-recurrences

mit 演算法 Lec2
mit 演算法 Lec2 mit 演算法 Lec2
mit 演算法 Lec2 Henry Chang
 
free Video lecture
free Video lecture free Video lecture
free Video lecture Edhole.com
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
Las funciones L en teoría de números
Las funciones L en teoría de númerosLas funciones L en teoría de números
Las funciones L en teoría de númerosmmasdeu
 
Prime numbers boundary
Prime numbers boundary Prime numbers boundary
Prime numbers boundary Camilo Ulloa
 
First order linear differential equation
First order linear differential equationFirst order linear differential equation
First order linear differential equationNofal Umair
 
Week 8 [compatibility mode]
Week 8 [compatibility mode]Week 8 [compatibility mode]
Week 8 [compatibility mode]Hazrul156
 
Data Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsData Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsAdila Krisnadhi
 
My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"Alexander Litvinenko
 
Lattices, sphere packings, spherical codes
Lattices, sphere packings, spherical codesLattices, sphere packings, spherical codes
Lattices, sphere packings, spherical codeswtyru1989
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved exMaths Tutoring
 
formulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equationformulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equationMahaswari Jogia
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Rational points on elliptic curves
Rational points on elliptic curvesRational points on elliptic curves
Rational points on elliptic curvesmmasdeu
 

Semelhante a 02 asymptotic-notation-and-recurrences (20)

mit 演算法 Lec2
mit 演算法 Lec2 mit 演算法 Lec2
mit 演算法 Lec2
 
free Video lecture
free Video lecture free Video lecture
free Video lecture
 
Time complexity
Time complexityTime complexity
Time complexity
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
Las funciones L en teoría de números
Las funciones L en teoría de númerosLas funciones L en teoría de números
Las funciones L en teoría de números
 
L2
L2L2
L2
 
Prime numbers boundary
Prime numbers boundary Prime numbers boundary
Prime numbers boundary
 
L2
L2L2
L2
 
First order linear differential equation
First order linear differential equationFirst order linear differential equation
First order linear differential equation
 
Number theory
Number theoryNumber theory
Number theory
 
Week 8 [compatibility mode]
Week 8 [compatibility mode]Week 8 [compatibility mode]
Week 8 [compatibility mode]
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Data Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description LogicsData Complexity in EL Family of Description Logics
Data Complexity in EL Family of Description Logics
 
My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"My PhD talk "Application of H-matrices for computing partial inverse"
My PhD talk "Application of H-matrices for computing partial inverse"
 
Lattices, sphere packings, spherical codes
Lattices, sphere packings, spherical codesLattices, sphere packings, spherical codes
Lattices, sphere packings, spherical codes
 
Dynamical systems solved ex
Dynamical systems solved exDynamical systems solved ex
Dynamical systems solved ex
 
formulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equationformulation of first order linear and nonlinear 2nd order differential equation
formulation of first order linear and nonlinear 2nd order differential equation
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
Rational points on elliptic curves
Rational points on elliptic curvesRational points on elliptic curves
Rational points on elliptic curves
 
NANO266 - Lecture 10 - Temperature
NANO266 - Lecture 10 - TemperatureNANO266 - Lecture 10 - Temperature
NANO266 - Lecture 10 - Temperature
 

Último

Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 

Último (20)

Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 

02 asymptotic-notation-and-recurrences

  • 1. Introduction to Algorithms 6.046J/18.401J LECTURE 2 Asymptotic Notation • O-, -, and -notation Recurrences • Substitution method • Iterating the recurrence • Recursion tree • Master method Prof. Erik Demaine September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.1
  • 2. Asymptotic notation O-notation (upper bounds): We write f(n) = O(g(n)) if there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.2
  • 3. Asymptotic notation O-notation (upper bounds): We write f(n) = O(g(n)) if there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0. EXAMPLE: 2n2 = O(n3) (c = 1, n0 = 2) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.3
  • 4. Asymptotic notation O-notation (upper bounds): We write f(n) = O(g(n)) if there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0. EXAMPLE: 2n2 = O(n3) (c = 1, n0 = 2) functions, not values September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.4
  • 5. Asymptotic notation O-notation (upper bounds): We write f(n) = O(g(n)) if there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0. EXAMPLE: 2n2 = O(n3) (c = 1, n0 = 2) funny, “one-way” functions, equality not values September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.5
  • 6. Set definition of O-notation O(g(n)) = { f(n) : there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0 } September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.6
  • 7. Set definition of O-notation O(g(n)) = { f(n) : there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0 } EXAMPLE: 2n2  O(n3) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.7
  • 8. Set definition of O-notation O(g(n)) = { f(n) : there exist constants c > 0, n0 > 0 such that 0  f(n)  cg(n) for all n  n0 } EXAMPLE: 2n2  O(n3) (Logicians: n.2n2  O(n.n3), but it’s convenient to be sloppy, as long as we understand what’s really going on.) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.8
  • 9. Macro substitution Convention: A set in a formula represents an anonymous function in the set. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.9
  • 10. Macro substitution Convention: A set in a formula represents an anonymous function in the set. EXAMPLE: f(n) = n3 + O(n2) means f(n) = n3 + h(n) for some h(n)  O(n2) . September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.10
  • 11. Macro substitution Convention: A set in a formula represents an anonymous function in the set. EXAMPLE: n2 + O(n) = O(n2) means for any f(n)  O(n): n2 + f(n) = h(n) for some h(n)  O(n2) . September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.11
  • 12. -notation (lower bounds) O-notation is an upper-bound notation. It makes no sense to say f(n) is at least O(n2). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.12
  • 13. -notation (lower bounds) O-notation is an upper-bound notation. It makes no sense to say f(n) is at least O(n2).  g(n)) = { f(n) : there exist constants c > 0, n0 > 0 such that 0  cg(n)  f(n) for all n  n0 } September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.13
  • 14. -notation (lower bounds) O-notation is an upper-bound notation. It makes no sense to say f(n) is at least O(n2).  g(n)) = { f(n) : there exist constants c > 0, n0 > 0 such that 0  cg(n)  f(n) for all n  n0 } EXAMPLE: n  (lg n) (c = 1, n0 = 16) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.14
  • 15. -notation (tight bounds)  g(n)) = O(g(n))  (g(n)) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.15
  • 16. -notation (tight bounds)  g(n)) = O(g(n))  (g(n)) 1 2 2 EXAMPLE: 2 n  2 n  ( n ) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.16
  • 17. -notation and -notation O-notation and -notation are like  and . o-notation and -notation are like < and >. g(n)) = { f(n) : for any constant c > 0, there is a constant n0 > 0 such that 0  f(n) cg(n) for all n  n0 } EXAMPLE: 2n2 = o(n3) (n0 = 2/c) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.17
  • 18. -notation and -notation O-notation and -notation are like  and . o-notation and -notation are like < and >.  g(n)) = { f(n) : for any constant c > 0, there is a constant n0 > 0 such that 0  cg(n) f(n) for all n  n0 } EXAMPLE: n   (lg n) (n0 = 1+1/c) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.18
  • 19. Solving recurrences • The analysis of merge sort from Lecture 1 required us to solve a recurrence. • Recurrences are like solving integrals, differential equations, etc.  Learn a few tricks. • Lecture 3: Applications of recurrences to divide-and-conquer algorithms. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.19
  • 20. Substitution method The most general method: 1. Guess the form of the solution. 2. Verify by induction. 3. Solve for constants. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.20
  • 21. Substitution method The most general method: 1. Guess the form of the solution. 2. Verify by induction. 3. Solve for constants. EXAMPLE: T(n) = 4T(n/2) + n • [Assume that T(1) = (1).] • Guess O(n3) . (Prove O and separately.) • Assume that T(k)  ck3 for k < n . • Prove T(n)  cn3 by induction. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.21
  • 22. Example of substitution T (n)  4T (n / 2)  n  4c(n / 2)3  n  (c / 2)n3  n  cn3  ((c / 2)n3  n) desired – residual  cn3 desired whenever (c/2)n3 – n  0, for example, if c  2 and n  1. residual September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.22
  • 23. Example (continued) • We must also handle the initial conditions, that is, ground the induction with base cases. • Base: T(n) = (1) for all n < n0, where n0 is a suitable constant. • For 1  n < n0, we have “ (1)”  cn3, if we pick c big enough. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.23
  • 24. Example (continued) • We must also handle the initial conditions, that is, ground the induction with base cases. • Base: T(n) = (1) for all n < n0, where n0 is a suitable constant. • For 1  n < n0, we have “ (1)”  cn3, if we pick c big enough. This bound is not tight! September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.24
  • 25. A tighter upper bound? We shall prove that T(n) = O(n2). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.25
  • 26. A tighter upper bound? We shall prove that T(n) = O(n2). Assume that T(k)  ck2 for k < n: T (n)  4T (n / 2)  n  4c ( n / 2) 2  n  cn 2  n 2  O(n ) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.26
  • 27. A tighter upper bound? We shall prove that T(n) = O(n2). Assume that T(k)  ck2 for k < n: T (n)  4T (n / 2)  n  4c ( n / 2) 2  n  cn 2  n 2  O(n ) Wrong! We must prove the I.H. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.27
  • 28. A tighter upper bound? We shall prove that T(n) = O(n2). Assume that T(k)  ck2 for k < n: T (n)  4T (n / 2)  n  4c ( n / 2) 2  n  cn 2  n 2  O(n ) Wrong! We must prove the I.H.  cn 2  ( n) [ desired – residual ]  cn 2 for no choice of c > 0. Lose! September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.28
  • 29. A tighter upper bound! IDEA: Strengthen the inductive hypothesis. • Subtract a low-order term. Inductive hypothesis: T(k)  c1k2 – c2k for k < n. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.29
  • 30. A tighter upper bound! IDEA: Strengthen the inductive hypothesis. • Subtract a low-order term. Inductive hypothesis: T(k)  c1k2 – c2k for k < n. T(n) = 4T(n/2) + n = 4(c1(n/2)2 – c2(n/2)) + n = c1n2 – 2c2n + n = c1n2 – c2n – (c2n – n)  c1n2 – c2n if c2  1. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.30
  • 31. A tighter upper bound! IDEA: Strengthen the inductive hypothesis. • Subtract a low-order term. Inductive hypothesis: T(k)  c1k2 – c2k for k < n. T(n) = 4T(n/2) + n = 4(c1(n/2)2 – c2(n/2)) + n = c1n2 – 2c2n + n = c1n2 – c2n – (c2n – n)  c1n2 – c2n if c2  1. Pick c1 big enough to handle the initial conditions. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.31
  • 32. Recursion-tree method • A recursion tree models the costs (time) of a recursive execution of an algorithm. • The recursion-tree method can be unreliable, just like any method that uses ellipses (…). • The recursion-tree method promotes intuition, however. • The recursion tree method is good for generating guesses for the substitution method. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.32
  • 33. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.33
  • 34. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: T(n) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.34
  • 35. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 T(n/4) T(n/2) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.35
  • 36. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 (n/4)2 (n/2)2 T(n/16) T(n/8) T(n/8) T(n/4) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.36
  • 37. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 (n/4)2 (n/2)2 (n/16)2 (n/8)2 (n/8)2 (n/4)2 (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.37
  • 38. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 n2 (n/4)2 (n/2)2 (n/16)2 (n/8)2 (n/8)2 (n/4)2 (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.38
  • 39. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 n2 5 n2 (n/4)2 (n/2)2 16 (n/16)2 (n/8)2 (n/8)2 (n/4)2 (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.39
  • 40. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 n2 5 n2 (n/4)2 (n/2)2 16 25 n 2 (n/16)2 (n/8)2 (n/8)2 (n/4)2 256 … (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.40
  • 41. Example of recursion tree Solve T(n) = T(n/4) + T(n/2) + n2: n2 n2 5 n2 (n/4)2 (n/2)2 16 25 n 2 (n/16)2 (n/8)2 (n/8)2 (n/4)2 256 … (1) Total = n 2  5  5 2 1  16 16      5 3 16  = (n2) geometric series September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.41
  • 42. The master method The master method applies to recurrences of the form T(n) = a T(n/b) + f (n) , where a  1, b > 1, and f is asymptotically positive. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.42
  • 43. Three common cases Compare f (n) with nlogba: 1. f (n) = O(nlogba – ) for some constant > 0. • f (n) grows polynomially slower than nlogba (by an n factor). Solution: T(n) = (nlogba) . September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.43
  • 44. Three common cases Compare f (n) with nlogba: 1. f (n) = O(nlogba – ) for some constant > 0. • f (n) grows polynomially slower than nlogba (by an n factor). Solution: T(n) = (nlogba) . 2. f (n) = (nlogba lgkn) for some constant k  0. • f (n) and nlogba grow at similar rates. Solution: T(n) = (nlogba lgk+1n) . September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.44
  • 45. Three common cases (cont.) Compare f (n) with nlogba: 3. f (n) = (nlogba + ) for some constant > 0. • f (n) grows polynomially faster than nlogba (by an n factor), and f (n) satisfies the regularity condition that a f (n/b)  c f (n) for some constant c < 1. Solution: T(n) = ( f (n)) . September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.45
  • 46. Examples EX. T(n) = 4T(n/2) + n a = 4, b = 2  nlogba = n2; f (n) = n. CASE 1: f (n) = O(n2 – ) for = 1.  T(n) = (n2). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.46
  • 47. Examples EX. T(n) = 4T(n/2) + n a = 4, b = 2  nlogba = n2; f (n) = n. CASE 1: f (n) = O(n2 – ) for = 1.  T(n) = (n2). EX. T(n) = 4T(n/2) + n2 a = 4, b = 2  nlogba = n2; f (n) = n2. CASE 2: f (n) = (n2lg0n), that is, k = 0.  T(n) = (n2lg n). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.47
  • 48. Examples EX. T(n) = 4T(n/2) + n3 a = 4, b = 2  nlogba = n2; f (n) = n3. CASE 3: f (n) = (n2 + ) for = 1 and 4(n/2)3  cn3 (reg. cond.) for c = 1/2.  T(n) = (n3). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.48
  • 49. Examples EX. T(n) = 4T(n/2) + n3 a = 4, b = 2  nlogba = n2; f (n) = n3. CASE 3: f (n) = (n2 + ) for = 1 and 4(n/2)3  cn3 (reg. cond.) for c = 1/2.  T(n) = (n3). EX. T(n) = 4T(n/2) + n2/lg n a = 4, b = 2  nlogba = n2; f (n) = n2/lg n. Master method does not apply. In particular, for every constant > 0, we have n (lg n). September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.49
  • 50. Idea of master theorem Recursion tree: a f (n) f (n/b) f (n/b) … f (n/b) a f (n/b2) f (n/b2) … f (n/b2) (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.50
  • 51. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) … (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.51
  • 52. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) h = logbn a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) … (1) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.52
  • 53. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) h = logbn a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) #leaves = ah … (1) = alogbn nlogba (1) = nlogba September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.53
  • 54. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) h = logbn a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) CASE 1: The weight increases … geometrically from the root to the (1) leaves. The leaves hold a constant nlogba (1) fraction of the total weight. (nlogba) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.54
  • 55. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) h = logbn a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) … CASE 2: (k = 0) The weight (1) is approximately the same on nlogba (1) each of the logbn levels. (nlogbalg n) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.55
  • 56. Idea of master theorem Recursion tree: f (n) f (n) a f (n/b) f (n/b) … f (n/b) a f (n/b) h = logbn a f (n/b2) f (n/b2) … f (n/b2) a2 f (n/b2) CASE 3: The weight decreases … geometrically from the root to the (1) leaves. The root holds a constant nlogba (1) fraction of the total weight. ( f (n)) September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.56
  • 57. Appendix: geometric series 1  x n 1 1  x  x2    xn  for x  1 1 x 1 2 1 x  x   for |x| < 1 1 x Return to last slide viewed. September 12, 2005 Copyright © 2001-5 Erik D. Demaine and Charles E. Leiserson L2.57