The diagram of a railroad switching system in Figure 7-18 is commonly used to il
ID: 3530906 • Letter: T
Question
The diagram of a railroad switching system in Figure 7-18 is commonly used to illustrate the notion of a stack. Identity three stacks m the figure and show how they relate to one another. Suppose you had four train cars arrive In the order shown: A followed by B, the n C, the n D. How could you use the railroad switch to change the order so that A is still B is still second, but D is third, and C is fourth? How could you use the railroad switch to change the order of the cars so that B is first, D is second, A is third and C is fourth? Can any possible permutation of railroad cars be achieved with this Justify your answer.Explanation / Answer
three stacks are the 3 tracks
a) A, goes in stack and pops out
B, goes in stack and pops out
C and Dgo in stack together and then D pops out and later C pops out
b)
A and Bgo in stack together and then B pops out
then A pops out
then C and D go in
then A pops in and pops out in the track 1
then D pops out
then A pops in and pops out
then C pops out
Note: till now when i said pops out (without explicitly stating in which track) i meant it pops out in track 3
c) any possible combination can be achived