872 views
1 votes
1 votes
pseudo code of stack

declare a stack  of characters

while (there are more character in the word to read)

{

read a character

push the  character on the stack

}

while(the stack is not empty)

{

 pop a character  off the stack

 write the character to the screen

}

What is the output of input "192761"?

1 Answer

0 votes
0 votes
for first while loop:

we push the character onto the stack we have till we have characters in the word  : 192761 into the stack.

for second while loop :

 pop is called and than printed,

as : 167291
edited by

Related questions

2 votes
2 votes
0 answers
1
amit166 asked Aug 8, 2018
750 views
Let S be a stack with operations push, pop, top, empty. What is displayed after following segment of code executes . for(i=1; i<=5; i++) ...