Professional Documents
Culture Documents
Lecture 10 Amortized Analysis
Lecture 10 Amortized Analysis
Mansi A. Radke
The canteen chai example!
• 1 person 10 minutes in the worst case
• 100 minutes?
• What when the tea pot is full? It can serve like 20 people!
• Accounting method
• Potential method
Aggregate analysis
• We determine an upper bound on the total cost of sequence of n
operations. The average cost per operation is then T(n)/n
• If you start with an empty stack, and you call MULTIPOP n times, it will
empty the stack in the first call and rest of the calls will be O(1)
• If pop, multipop and push all are combined, total cost would be O(n)