The accounting method is one of the main methods used in amortised analysis of algorithms. The core principle is simple:

  • For an operation and a sequence of inputs .
  • Let be the actual cost of and be the amortised cost for .
  • Then, for each input, we assign a credit, where is the leftover credit after executing operation . We require that .
    • If , i.e., the amortised cost is more, we can execute the operation. Then, we store the difference as “credit” to be used for later operations.
    • If , the actual cost is more. In this case, we use the credit that we’ve built up to execute the operation. Even if the difference , we can still use the credit to ensure the summation is non-negative.
      • If the summation is non-negative, then the guess for is wrong.

Another aspect of our proof is the credit invariant. We make a claim about the value of the cumulative stored credit . Usually it looks something like “element with property contains stored credit ( can be dependent on property )“.

Then, if we show that the credit invariant always maintains positive stored credit, i.e., for all , then each operation is amortised.