+1 vote
in Data Structures & Algorithms I by (110k points)
What should be done when an opening parentheses is read in a balancing symbols algorithm?

(a) push it on to the stack

(b) throw an error

(c) ignore the parentheses

(d) pop the stack

Question is from Application of Stacks in section Application of Stacks of Data Structures & Algorithms I

This question was addressed to me in my homework.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
The correct answer is (a) push it on to the stack

Best explanation: When an opening bracket/braces/parentheses is encountered, it is pushed on to the stack. When the corresponding end bracket/braces/parentheses is not found, throw an error.

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.