Data Structures and Algorithms - Stacks

16. Stack can't be used to

Cancel reply

Your email address will not be published.


Cancel reply

Your email address will not be published.


17. Which of the following permutations can be obtained in the output(in the same order),using a stack assuming that the input is the sequence 1,2,3,4,5 in that order?

Cancel reply

Your email address will not be published.


Cancel reply

Your email address will not be published.


18. Stack is useful for implementing

Cancel reply

Your email address will not be published.


Cancel reply

Your email address will not be published.


19. If the sequence of operations- push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop, are performed on a stack, the sequence of popped out values are

Cancel reply

Your email address will not be published.


Cancel reply

Your email address will not be published.


20. In evaluating the arithmetic expression 2 * 3-(4+5), using stacks to evaluate its equivalent post-fix form, which of the following stack configuration is not possible?

  • Option : D
  • Explanation : The postfix equivalent is 2 3 * 4 5 + -. For evaluating this using stack, starting from the left, we have to scan one by one. If it is an operand push. if it is an operator, pop it twice, apply the operator on the popped out entries and push the result onto the stack. If we follow this, we can find the configuration in option (d) is not possible.
Cancel reply

Your email address will not be published.


Cancel reply

Your email address will not be published.