{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 20 - 19:31:55 CS 61B Lecture 20 Wednesday Todays reading 1...

This preview shows pages 1–2. Sign up to view the full content.

10/11/10 19:31:55 1 20 CS 61B: Lecture 20 Wednesday, October 13, 2010 Today’s reading: Goodrich & Tamassia, Chapter 4 (especially 4.2 and 4.3). ASYMPTOTIC ANALYSIS (bounds on running time or memory) =================== Suppose an algorithm for processing a retail store’s inventory takes: - 10,000 milliseconds to read the initial inventory from disk, and then - 10 milliseconds to process each transaction (items acquired or sold). Processing n transactions takes (10,000 + 10 n) ms. Even though 10,000 >> 10, we sense that the "10 n" term will be more important if the number of transactions is very large. We also know that these coefficients will change if we buy a faster computer or disk drive, or use a different language or compiler. We want a way to express the speed of an algorithm independently of a specific implementation on a specific machine--specifically, we want to ignore constant factors (which get smaller and smaller as technology improves). Big-Oh Notation (upper bounds on a function’s growth) --------------- We use Big-Oh notation to say how slowly code might run as its input grows. Let n be the size of a program’s _input_ (in bits or data words or whatever). Let T(n) be a function. For now, T(n) is precisely equal to the algorithm’s running time, given an input of size n (usually a complicated expression). Let f(n) be another function--preferably a simple function like f(n) = n. We say that T(n) is in O( f(n) ) IF AND ONLY IF T(n) <= c f(n) WHENEVER n IS BIG, FOR SOME LARGE CONSTANT c. * HOW BIG IS "BIG"? Big enough to make T(n) fit under c f(n). * HOW LARGE IS c? Large enough to make T(n) fit under c f(n).

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern