Questions:
Stack to the top of the stack once the element ABCD in the Fifth Element e into the stack before the stack elements can be out of the stack, then the stack sequence may be _____a d___________.
A. abced
B. Dbcea
C. Cdabe
D. Dcbea
Analysis:
1. Assuming that the stack sequence is from small to large rehearsal (that is, a<b<c<d<e), there is no "size" in the stack sequence, because the "large number" after the stack, "medium" in the stack is on the "decimal", so can only be out of the "median" and then out "decimal"
2. It is wrong to include the following sequence in the stack sequence: CAB,DAB,DAC,EAB,EAC,EAD,EBC,EBD, including adding other numbers in the middle of these sequences is the wrong sequence, such as CADB,CAEB (larger size).
For a. Answer: A into the stack, immediately out of the stack, b into the stack, immediately out of the stack, c into the stack, immediately out of the stack, d into the stack, e into the stack, e out of the stack, d out of the stack
For D. Answer: A into the stack, b into the stack, c into the stack, d into the stack, d out of the stack, c out of the stack, b out of the stack, e into the stack, e out of the stack, a out of the stack
Other answers are not possible, contrary to the above "big" "small", "medium" principle
Stack in C + +, stack rule: a,b,c,d,e