Lably
Skip to content

Accounting method (computer science)

Method of amortized analysis

  • 5 min read
  • 2 chapters

Related on Lably

Through Computer science, Accounting and Big O notation

The accounting method is most naturally suited for proving an O(1) bound on time. The method as explained here is for proving such a bound.

The method

A set of elementary operations which will be used in the algorithm is chosen and their costs are arbitrarily set to 1. The fact that the costs of these operations may differ in reality presents no difficulty in principle. What is important is that each elementary operation has a constant cost.

Each aggregate operation is assigned a "payment". The payment is intended to cover the cost of elementary operations needed to complete this particular operation, with some of the payment left over, placed in a pool to be used later.

The difficulty with problems that require amortized analysis is that, in general, some of the operations will require greater than constant cost. This means that no constant payment will be enough to cover the worst case cost of an operation, in and of itself. With proper selection of payment, however, this is no longer a difficulty; the expensive operations will only occur when there is sufficient payment in the pool to cover their costs.

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication