Friday, September 7, 2012

Lecture 8. Amortized Analysis (2)

Today, we introduce 3 ways of analyzing the amortized cost of an algorithm. We use  the problem of simulating a queue by two stacks as an example.

These 3 mehtods are aggregate analysis, banker's method and physicist's method.  Aggregate analysis basically analyzes the average cost of  n different operations. Banker's method is a generalization (of aggregate analysis) which allows us to assign different cost to different operations as long as the cost we pay can always cover the time we spend on the operations. The physicist's method introduce a potential function (which can be viewed as all the credits available in the banker's method). After defining the potential function, it naturally induces a amortized cost for each operation.

No comments:

Post a Comment