Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 5, Problem 1P

(a)

Program Plan Intro

To show that the expected value represented by the counter after n INCREMENT operations that have been performed is exactly n.

(a)

Expert Solution
Check Mark

Explanation of Solution

Given Information: The INCREMENT operation works on a counter containing the value i in a probabilistic manner. If i=2b1 then it shows an overflow error. Otherwise, it increases the counter by 1 with probability 1/(ni+1ni) and leaves the counter with probability 11/(ni+1ni) .

Explanation:

The counter after n INCREMENT operations is performed exactly n times for the expected value.

Consider that the initial value of the counter is i and increasing the number representation from ni to ni+1 with a probability of 1ni+1ni and leaving the value unchanged.

The expected increase is calculated as,

  ni+1nini+1ni=1

Hence, the expected increment represented by the counter is 1.

(b)

Program Plan Intro

To calculate the variance in the value represented by the register after n INCREMENT operations have been performed.

(b)

Expert Solution
Check Mark

Explanation of Solution

Given Information: Consider a simple case: ni=100i for all i0 and variance of the counter depends on the ni .

Explanation:

Consider that Vn and Xj are the variant and pairwise independent events. The variance Vn is calculated as,

  Var[Vn]=Var[X1]+Var[X2]+Var[Xn]

Since ni=100i and ni+1ni=100(i+1)100i=100 . Therefore, the value represented by the counter with probability 99/100 due to the jth INCREMENT is 0 and with the probability of 1/100 .

The value represented increases by 100. Therefore, by the equation (C.27)

  Var[Xj]=E[Xj2]E2[Xj]=(( 0 2 99 100 )+( 100 2 1 100 ))12=1001=99

Now, adding the variances of the Xj gives Var[Vn]=99n .

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
3. Give an example of a random variable X that takes on values from the set of all binary strings of length 4 where the min-entropy of X and the entropy of X are very different. Explain what is causing this phenomenon.
Can you explain the difference between BPP (Bounded-Error Probabilistic Polynomial-Time) and BQP (Bounded-Error Quantum Polynomial-Time)? I feel like they are both in the P polynomial time area of solvability, just one deals with quantum and the other with a slightly higher level above just P.
Give the best possible asymptotic upper bound for the following code block. Explain your answer in detail. i = 1; while(i < n){           i = i*2;           j = 1;           while(j < i){                      j = j*3;                     k = 1;                     while(k < j){                                k = k*4;                     }          } }
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education