6 kinds of analysis worst case usually average case

  • No School
  • AA 1
  • 22

This preview shows page 6 - 15 out of 22 pages.

6
Image of page 6
Kinds of analysis Worst-case (usually) Average-case (sometimes) Best-case
Image of page 7
Worst-case: (usually) The worst-case efficiency of an algorithm is its efficiency for the worst-case input of size n, which is an input (or inputs) of size n for which the algorithm runs the longest among all possible inputs of that size. • T(n) = maximum time of algorithm on any input of size n.
Image of page 8
Average-case: (sometimes) T(n) = expected time of algorithm over all inputs of size n. • Need assumption of statistical distribution of inputs.
Image of page 9
Best-case: The best-case efficiency of an algorithm is its efficiency for the best-case input of size n, which is an input (or inputs) of size n for which the algorithm runs the fastest among all possible inputs of that size
Image of page 10
How to devise(develop) algorithms Something of an art form Cannot be fully automated We will describe some general techniques and try to illustrate when each is appropriate
Image of page 11
Expressing Algorithms Implementations Pseudo-code English My main concern here is not the specific language used but the clarity of your expression
Image of page 12
Verifying algorithm correctness Proving an algorithm generates correct output for all inputs One technique covered in textbook Loop invariants: A loop invariant is a condition that is necessarily true immediately before and immediately after each iteration of a loop .
Image of page 13
Analyzing algorithms The “process” of determining how much resources (time, space) are used by a given algorithm We want to be able to make quantitative assessments about the value (goodness) of one algorithm compared to another We want to do this WITHOUT implementing and running an executable version of an algorithm
Image of page 14
Image of page 15

You've reached the end of your free preview.

Want to read all 22 pages?

  • Fall '19

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 ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors