A revision of the Amortized Accounting Method that is stateless and uses a potential function.

Definition

  • Given a data structure, let be size of data structure (size of stack, size of list, etc..)
  • Define a potential function
    • Tracks number of stored elements
    • Tracks distance from threshold
    • Tracks how unbalanced a structure is
  • Let
  • Let total time
  • Let the amortized cost
  • Then, the total amortized time is:

Proving Process

  1. Define
  2. Show (greater than 0 for all states)
  3. Prove for all sequences of operations
  4. Let
  5. Then, (Note that this can be different for diff operations)

Example

  • Suppose data structure is Expandable Array
  • Define invariant as
  • Define
  • Then,
  • Prove operations
  • get(), size(), set(i,x) do not change size or capacity,
  • add(x):
    • If no copying (no resizing):
    • If copying: