Question: Consider the following pseudocode: declare a stack of characters while ( there are more characters in the word to read ) { read a character
Consider the following pseudocode: declare a stack of characters while ( there are more characters in the word to read ) { read a character push the character on the stack } while ( the stack is not empty ) { write the stack's top character to the screen pop a character off the stack } What is written to the screen for the input "carpets"?
| serc | ||
| carpets | ||
| steprac | ||
| ccaarrppeettss | ||
| sstteepprraacc |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
