AmortizedAnalysis

2 an 8 bit binary counter as its value goes from 0 to

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: 23 25 26 31 Figure 17.2 An 8-bit binary counter as its value goes from 0 to 16 by a sequence of 16 I NCREMENT operations. Bits that flip of bits flipped. 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. 12 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 Binary counter Goal. Increment a k-bit binary counter (mod 2k). Counter value A[ 7 A[ ] 6] A[ 5 A[ ] 4 A[ ] 3 A[ ] 2] A[ 1 A[ ] 0] Representation. aj = jth l17.1 Aggregate analysis bit of counter. east significant 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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 455 Total cost 0 1 3 4 7 8 10 11 15 16 18 1...
View Full Document

This document was uploaded on 02/05/2014.

Ask a homework question - tutors are online