Jump to content

Potential method

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ripper234 (talk | contribs) at 17:03, 7 July 2006 (Created). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In Computational complexity theory, the Potential method is a method used to analyze amortized time and space complexities of algorithms. It can be thought of as a generalization of the Accounting method and the debit method. It is useful in cases where it is hard to assign credit to specific elements of the structure.

The method

Similar to potential in physics, a potential function is a real valued function from states of the data structure in question. Assume a data structure goes through a series of states after n different operations, and is a potential function. If is the runtime of operation number i, we define its amortized runtime to be .

The total runtime of the n operations equals . If satisfies then the runtime of all n operations is less or equal the sum of all amortized times.

Example application

The problem of Table expansion can be solved using the potential method. Choose as potential function the number of occupied cells minus the number of vacant cells. Every regular inserts increases the potential by O(1). An insert that causes reallocation decreases the potential by n, which is the exact amount of work done in the reallocation, thus getting O(1) amortized time for insert.

See also

Amortized analysis in the University of Texas