Imagine we have two empty stacks of integers s1 and s2 Draw
. Imagine we have two empty stacks of integers, s1 and s2. Draw a picture of each stack after the following operations:
1. pushStack (s1, 3)
2. pushStack (s1, 5)
3. pushStack (s1, 7)
4. pushStack (s1, 9)
5. pushStack (s1, 11)
6. pushStack (s1, 13)
7. loop not emptyStack (s1)
1 popStack (s1, x)
2 popStack (s1, x)
3 pushStack (s2, x)
8 end loop
This is a C data structure question. Please use C language , thanks a lot!
Solution
The picture of each stack after the following operations is:
Stack s1 is
S1
The picture of Stack s2 is
S2
| 9 |
| 7 |
| 5 |
| 3 |
| 13 |
| 11 |
