Question 1What is wrong with the procedure on the right, and how would you fix it? |
|
Question 2What is the output of the program to the right: |
|
Draw the array representation of the heap after the value 10 is inserted.
Draw the array representation of the heap after a Delete_Min() operation.
Question 5In the Tequila plant simulation, we ended up with this definition of a Distillation Unit:Explain why we need to have failure_ptr as part of the Distillation Unit. Moreover, explain every place in the simulation that it is either set or used. You may want to draw the simulation's state diagram and use that for reference. |
|
Barney |
Betty |
Barney and Betty want to generate random numbers, and they show you the CDF plots above. Clearly, they both have problems. First, explain to me what CDF(x) is in English. Second, explain what a CDF plot shows. Finally, explain to me what the problems are with Barney and Betty's CDF plots.
Question 7This question concerns the CDF to the right.
|
|
|
Each line is a performance test of the given technique.
An example is the following file:
cauchy_good 0.225604 cauchy_good 2.804108 evenodd 1.247746 liberation 0.978000 cauchy_good 6.156661 rdp 1.005819 liberation 1.978000 |
Write a program that reads a file in the above format on standard input. After reading the file, it should print out the Technique which has the smallest average time. For example, suppose I call the program on the file above. It will print rdp, because it has the smallest average time (liberation's average is 1.478 and cauchy_good's average is 3.062124).
To help you out, I have put skeleton of the program on the answer sheet. You do not need to add any more variable declarations to this program. You may also assume that standard input is in the correct format, and there is at least one test on standard input.