1.

What should be done when a left parenthesis ‘(‘ is encountered?(a) It is ignored(b) It is placed in the output(c) It is placed in the operator stack(d) The contents of the operator stack is emptiedMy question comes from Application of Stacks in section Application of Stacks of Data Structures & Algorithms IThe question was posed to me in my homework.

Answer»

The correct choice is (C) It is placed in the OPERATOR stack

Easiest EXPLANATION - When a left PARENTHESIS is encountered, it is placed on to the operator stack. When the corresponding right parenthesis is encountered, the stack is popped until the left parenthesis and remove both the parenthesis.



Discussion

No Comment Found

Related InterviewSolutions