5 - CMPSCI 187: Programming With Data Structures Lecture 5:...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPSCI 187: Programming With Data Structures Lecture 5: Analysis of Algorithms Overview 16 September 2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
Analysis of Algorithms Overview • What is Analysis of Algorithms? • Being Usefully Vague About Functions • Important Classes of Growth Functions • Determining Time Complexity From Code
Background image of page 2
What is Analysis of Algorithms? • We want to talk about the resources, usually time, used by an algorithm, as a function of the input size. • The time may be different for different inputs of the same size -- we take the worst-case time because we want to make a guarantee to the user. • The time complexity of an algorithm is a function with the number of input bits as its input, and the worst-case running time (in seconds, say, or in clock cycles) as the output. • But such a function is very hard to work with. We need to develop a better mathematical way of talking about such functions, called asymptotic analysis or big-O notation .
Background image of page 3

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

View Full DocumentRight Arrow Icon
• Let f(n) be the time (in seconds) that it takes to wash n dishes. • Individual dishes may be cleaner or dirtier, but say that the worst take 30 seconds. • In the Good Method, where the washing of later dishes doesn’t affect the earlier ones, we have that f(n) is at most 30n seconds. In the worst case where every dish is horribly dirty, we take exactly 30n seconds. • In the Bad Method, washing the i’th dish soils the Frst i-1 dishes.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/22/2011 for the course COMPSCI 187 taught by Professor Barrington during the Fall '11 term at UMass (Amherst).

Page1 / 10

5 - CMPSCI 187: Programming With Data Structures Lecture 5:...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online