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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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. 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: •...
View Full Document

This note was uploaded on 11/15/2010 for the course COMPUTER S CPSC 320 taught by Professor Patrice during the Winter '10 term at UBC.

Page1 / 6

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

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

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