Amortized Time

From Notes
Jump to navigation Jump to search

An average time for performing an operation.

Plotting

Suppose that is the time recorded for an input size of elements. The amortized cost per operation would be . If we plot this on a graph using as the -coordinate and as the -coordinate, we can see how time relates to input size.

Amortized time can also be considered a way to determine the coefficients for a known behavior. For example, if we know that a function runs in time, we can estimate the coefficient with the following fraction: .

Common Plot Types

See Asymptotic Analysis for information on Big-O notation.

  • Constant:
  • Linear:
  • Logarithmic:
  • Quadratic:
  • Exponential: