aa-nutshell

# aa-nutshell - Amortized Analysis a Summary Patrice...

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

Amortized Analysis: a Summary Patrice Belleville Department of Computer Science University of British-Columbia November 8, 2010 1 What is amortized analysis? Amortized is a topics in analysis of algorithms that is unfortunately not covered well in most textbooks. The only text that actually discusses it in details is that by Cormen et al. [1] (chapter 17), but the authors do not spend enough time explaining the intuition behind the potential method (which is the only method that will be discussed in this document). It is also explained very briefly in the book by Goodrich and Tamassia [3]. Other texts use it, but either do not mention its name, or assume that the reader already knows about it. This short document is an attempt at filling in this gap, and giving you an additional source of information beyond the notes you may have written in class. I will refer to the examples you have seen in class, tutorials, and on the assignments from time to time (as I do not have time right now to write them all out as part of this document). Let us first talk about what amortized analysis is not. It is not a technique used to design algorithm. If you are given a problem to solve, you do not start by saying: “I can take the general structure of an amortized analysis algorithm 1 and fill in the blanks to get a solution to my problem”. Hence it is not like divide-and-conquer or dynamic programming. You can not use amortized analysis to design your solution. It is not a way to speed up an already designed algorithm. You can not take an algorithm and make it faster using amortized analysis. Amortized analysis is a technique that we use to analyze an algorithm’s running time, and obtain a good upper-bound on the worst-case running time of a sequence of operations. These operations can be the parts of an algorithm, or simply operations performed in sequence on a data structure. Once again Amortized analysis only allows us to obtain a bound on the worst-case running time of a sequence of operations . It does not help us get a better bound on the worst-case running time of one operation, because it relies on the fact that even 1 Whatever that might be.

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

View Full Document
2 if one operation can be expensive, it’s not possible to only perform expensive operations. Amortized analysis does not change the algorithm in any way. It’s just a way to count the running time more precisely than by just adding up the worst-case running times of each operation in the sequence. 2 The potential method As the old adage says, “Time is Money”. When thinking about amortized analysis, it helps to think of running time as a cost we have to pay. That is, each step costs us 1\$, and the worst-case running time of a sequence of operations is the maximum amount we will need to pay to execute these operations. The idea behind the potential method is thus the following:
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