AmortizedAnalysis

Increment 7 6 5 4 3 2 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0

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: t 7 6 5 4 3 2 1 0 0 1 0 0 1 1 1 0 1 24 Binary counter: potential method Potential function. Let Φ(D) = number of 1 bits in the binary counter D. ・Φ(D0) = 0. ・Φ(Di) ≥ 0 for each Di. increment 7 6 5 4 3 2 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 25 Binary counter: potential method Potential function. Let Φ(D) = number of 1 bits in the binary counter D. ・Φ(D0) = 0. ・Φ(Di) ≥ 0 for each Di. 7 6 5 4 3 2 1 0 0 1 0 1 0 0 0 0 26 Binary counter: potential method Potential function. Let Φ(D) = number of 1 bits in the binary counter D. ・Φ(D0) = 0. ・Φ(Di) ≥ 0 for each Di. Theorem. Starting from the zero counter, a sequence of n INCREMENT operations flips O(n) bits. Pf. ・Suppose that the ith increment operation flips ti bits from 1 to 0. operation sets one bit to 1 (unless counter resets to zero) ・The actual cost ci ≤ ti + 1. ・The amortized cost ĉi = ci + Φ(Di) – Φ(Di–1) ≤ ci + 1 – ti ≤ 2. ▪ 27 Famous potential functions Fibonacci heaps. Φ(H) = trees(H) + 2 marks(H). Splay trees. log2 size(x) (T ) = xT Move-to-front. Φ(L) = 2 × inversions(L, L*)...
View Full Document

This document was uploaded on 02/05/2014.

Ask a homework question - tutors are online