AmortizedAnalysis

Starting from the172 an counter a sequence of n0 ito

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: 9 22 23 25 26 31 Theorem. Starting from the17.2 An counter, a sequence of n0 Ito 16 by a sequence of 16 I NCREMENT zero 8-bit binary counter as its value goes from NCREMENT Figure operations. operations flips O(n k) bits. Pf. At most k bits Bits that flip to achieve the next value are shaded. The running cost for flipping bits is shown at the right. Notice that the total cost is always less than twice the total number of I NCREMENT operations. flipped per increment. ▪ 13 operations on an initially zero counter causes AŒ1 to flip bn=2c times. Similarly, bit AŒ2 flips only every fourth time, or bn=4c times in a sequence of n I NCREMENT i Aggregate method (brute force) Aggregate method. Sum up sequence of operations, weighted by their cost. Counter value 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 455 A[ 7 A[ ] 6] A[ 5 A[ ] 4 A[ ] 3 A[ ] 2] A[ 1 A[ ] 0] 17.1 Aggregate analysis 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Total cost 0 1 3 4 7 8 10 11 15 16...
View Full Document

Ask a homework question - tutors are online