1.

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 stackQuestion is from Application of Stacks in section Application of Stacks of Data Structures & Algorithms IThis question was addressed to me in my homework.

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.



Discussion

No Comment Found

Related InterviewSolutions