Data Structures and Algorithms - Stacks

21. Stack A has the entries a, b, c (with an on top), Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of stack B can only be printed. In the arrangement, which of the following permutations of a, b, c is not possible?

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


22. The postfix equivalent of the prefix * + a b - c d is

  • Option : A
  • Explanation : The tree whose preorder traversal yields * + A B – C D, is given in fig 6.18. Writer the post-order traversal of the tree. That is the postfix form.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


23. Stacks cannot be used to

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


24. The postfix expression for the infix expression A + B* (C+D) / F + D*E is

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


25. Stack is useful for implemeting

  • Option : D
  • Explanation : Breadth-first search needs Queue for implementation
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *