AmortizedAnalysis

22 potential method physicists method potential

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: h data structure Di. Actual and amortized costs. ・ci ・ĉi = actual cost of ith operation. = ci + Φ(Di) – Φ(Di–1) = amortized cost of ith operation. 22 Potential method (physicist's method) Potential function. Φ(Di) maps each data structure Di to a real number s.t.: ・Φ(D0) = 0. ・Φ(Di) ≥ 0 for each data structure Di. Actual and amortized costs. ・ci ・ĉi = actual cost of ith operation. = ci + Φ(Di) – Φ(Di–1) = amortized cost of ith operation. Theorem. Starting from the initial data structure D0, the total actual cost of any sequence of n operations is at most the sum of the amortized costs. Pf. The amortized cost of the sequence of operations is: n n n n ci = ˆ ci = ˆ i=1 i=1 = = ( ci + ( D i ) ( ci + ( D i ) i=1 i=1 n n i=1 i=1 n n i=1 i=1 ( Di ( Di ci + ( D n ) ci + ( D n ) (D0 ) (D0 ) ci ci 1) 1) ▪ 23 Binary counter: potential method Potential function. Let Φ(D) = number of 1 bits in the binary counter D. ・Φ(D0) = 0. ・Φ(Di) ≥ 0 for each Di. incremen...
View Full Document

This document was uploaded on 02/05/2014.

Ask a homework question - tutors are online