The code in StreamMerge (see Section 7.1) assumes that EOS is larger than the other values in the stream. This exercise explores removing that assumption.
(a) Run the original program. To make the program concrete, have process one send the stream $1,3,5,7,9$, EOS and process two send the stream 4,8 , EOS.
(b) Run the program from part (a) with the following values of EOS: 99, -99 , and 6. Compare each of the outputs from these runs with the output from the program in part (a); explain any differences
(c) The program in part (b) implicitly assumes that EOS appears only at the end of the stream. Or, if EOS does appear midstream, it is still interpreted as EOS, and thus terminates the stream; subsequent numbers are just ignored. Confirm this behavior by running the program with EOS set to 5 .
(d) Rewrite the code in StreamMerge so EOS can be an arbitrary integer value that is not necessarily larger than the other values in the stream. (Assume that EOS appears only as stated in part (c).) This program's behavior should be identical to the original program's behavior except for the value of EOS it outputs. Run the modified program for the values of EOS given in part (b).