Data Structures and Algorithms - Stacks

11. Postfix expression is merely the reverse of the prefix expression

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 *


12. Following sequence of operations is performed on a stack push(1),push(2),pop, push(1),push(2)pop,pop,pop,push(2),pop.The sequence of poped out values are

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 *


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

  • Option : D
  • Explanation : The postfix equivallent 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. Required fields are marked *


Cancel reply

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


14. Stack A has the entries a,b,c(with a 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 the stack B can only be printed. In this arrangement, which of the following permutations of a,b,c are 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 *


15. The expression which accesses the (ij)th entry of am x n matrix stored in column major form 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 *