Of an algorithm by implication we also bound the

Info icon This preview shows pages 10–13. Sign up to view the full content.

View Full Document Right Arrow Icon
of an algorithm, by implication we also bound the running time of the algorithm on any arbitrary inputs as well. For example, the best-case running time of insertion sort is Ω(n), which implies that the running time of insertion sort is Ω(n). 2.3.5 Asymptotic Notations Θ , O and Ω in Equations Example a) . Let consider the formula 2 · n 2 + 3 · n +1 =2 · n 2 + Θ (n) . How do we interpret such a formula?
Image of page 10

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
In general, however, when asymptotic notation appears in a formula, we interpret it as standing for some anonymous function that we do not care to name. Thus, in the above example we have: 2 · n 2 + 3 · n +1 =2 · n 2 + Θ (n) , where f(n) Θ (n) . We can notice that in this case f(n)= 3 · n +1 , which indeed is Θ (n). Example b) . Using asymptotic notation in this manner can help eliminate inessential detail and clutter in an equation. For example let be the recursive relation: )n()/n(T)n(T Θ+ =22 If we are interested only in the asymptotic behavior of T(n) , there is no point in specifying all the lower-order terms exactly; The lower-order terms are all understood to be included in the anonymous function denoted by the term Θ (n). Example c) . In some cases, asymptotic notation appears on the left-hand side of an equation, as in 2 · n 2 + Θ (n)= Θ (n 2 ) We interpret such equations using the following rule: No matter how the anonymous functions are chosen on the left of the equal sign, there is a way to choose the anonymous functions on the right or the equal sign to make the equation valid. Thus, the meaning of our example is that for any function f(n ) Θ (n), there is some function f(n) Θ (n 2 ), such that 2 · n 2 + f(n) = g(n) for all n . In other words, the right-hand side of an equation provides coarser level of detail than the left- hand side. Example d) . A number of such relationship can be chained together as in: )n()n(nnn 222 2132Θ=Θ+ =+ + We can interpret each equation separately by the rule above. The first equation says that there is some function f(n) Θ (n) such that 2 · n 2 + 3 ·n + 1 = 2 · n 2 + f(n) for all n . The second equation says that for any function g(n) Θ (n) (such as the f(n) just mentioned), there is some function h(n) Θ (n 2 ) such that 2 · n 2 + g(n) = h(n) for all n .
Image of page 11
Note that this interpretation implies that 2 · n 2 + 3 ·n + 1 = Θ (n 2 ) , which is what the chaining of equations intuitively gives us. 2.3.6 o-notation The asymptotic upper bound provided by O-notation may or may not be asymptotically tight . The bound 2 · n 2 = O(n) is asymptotically tight, but the bound 2 · n = O(n 2 ) is not. • We use o-notation to denote an upper bound that is not asymptotically tight [CLR92]: ----------------------------------------------------------- o(g(n)) = { f(n) : for any positive constant c>0 there exists a constant n 0 >0 such that 0 ≤ f(n) < c·g(n) for n ≥ n 0 } [2.3.6.a] ----------------------------------------------------------- The main difference is that in f(n) = O(g(n)) , the bound 0 ≤ f(n) ≤ c·g(n) holds for some constant c > 0 , but in f(n) = o(g(n) , the bound 0 ≤ f(n) < c·g(n) holds for all constants c > 0 .
Image of page 12

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern