+1 vote
in Data Structures & Algorithms I by (110k points)
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 emptied

My question comes from Application of Stacks in section Application of Stacks of Data Structures & Algorithms I

The question was posed to me in my homework.

1 Answer

+1 vote
by (408k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...