tials grow faster than all polynomials property with a 1 1 and k 2 n 2 isO 2n 2

Tials grow faster than all polynomials property with

This preview shows page 1 - 3 out of 3 pages.

tials grow faster than all polynomials" property with a = 1 . 1 and k = 2 . n 2 is O (2 n 2 + 4) : True. We use big- O notation to strip away constant multiples and lower- order terms, but that doesn’t make expressions like O (2 n 2 + 4) meaningless. n 2 is eventually bounded by 2 n 2 + 4 , which is all that matters. Exercise Solution: Bounding Running Times of Algorithms A simple technique for bounding the running time of an algorithm involves the following steps: 1. For each "primitive" statement (i.e. statements which can execute in isolation), assign a bound on its running time individually, and write it to the right of the statement. 1
Image of page 1
COMP2123/2823/9123 Solutions 2. For each "if" statement, bound the amount of time it takes to evaluate the condition, and write it to the right of the statement. You can assume that actually branching to the body of the "if" statement (or the body of an attached "else" statement) takes constant time. 3. To bound the running time of a loop, sum up the time bounds on all statements within the loop (except for those within nested loops), multiply the result by the number of iterations carried out by the loop (or an upper bound thereof), and write it to the right of the loop statement.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Three '18
  • Alex, Big O notation, Articles with example pseudocode, Tree traversal, Nested set model

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

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors