Question: ( a ) Write a function: reverseStack ( Stack st ) , which prints the contents of the stack st in reverse ( i .
a Write a function: reverseStackStack st which prints the contents of the stack st in reverse ie the top of the stack is printed last
You are allowed only to use another stack, Stack st That is you cannot use any arrays etc. The only functions you can use on stacks are pop push and emptyHint: You put the contents of one stack into another by popping and pushing. Is the order the same?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
