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"? DS stack + – amit166 asked Aug 8, 2018 amit166 872 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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 arvin answered Aug 8, 2018 • edited Aug 8, 2018 by arvin arvin comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments arvin commented Aug 8, 2018 reply Follow Share @shaik masthan : yes bro but popped values will be printed in reverse. 0 votes 0 votes Shaik Masthan commented Aug 8, 2018 reply Follow Share Why popped values print in reverse... After popping., you immediately print... I hope, you mistakenly assume that, printing the elements statement is not under while loop.... Check one more time 1 votes 1 votes arvin commented Aug 8, 2018 reply Follow Share @shaikh u are right i assumed pop as a function call . my mistake i accept. updated thanks:p 1 votes 1 votes Please log in or register to add a comment.