Question: Do allpleasecomputer architecture 4. I have a closet with four drawers Di , 1 i 4. Each Di holds either nothing or an apple, which,

Do allpleasecomputer architecture

4. I have a closet with four drawers Di , 1 i 4. Each Di holds either nothing or an apple, which, respectively, corresponds to 0 and 1. Clearly, each configuration encodes a number. For instance, the configuration where

D1 has an apple;

D2 has nothing;

D3 has an apple;

D4 has an apple;

Encodes the binary number 1011 which has value eleven. I have the following instruction set:

Empty(i): test Di is empty or not;

Put(i): buy an apple and put it in Di ;

Eat(i): remove the apple in Di and eat it.

Try to write a program that increments four to the value encoded by a configuration.

5. I can consider a closet with n drawers and design a similar program to answer the question in Prob 4. Now, when n approaches to infinity, how many apples you are going to eat, on average, when the program runs on a configuration? (a lot of math)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!