To be able to utilize stacks in a Java program.
For this lab, you will write a program that checks whether a string of parentheses and brackets is well-formed or not. The strings will be considered well-formed if each opening parenthesis/bracket is matched with exactly one closing parenthesis/bracket.
For example, the following strings are well-formed:
While the following are not:
This problem is best solved with a stack. The basic idea is to store the opening symbols on a stack. When you see a closing symbol, pop off the next opening symbol and make sure it matches. When done, ensure the stack is empty.
When you're finished, please submit your code for this lab on Canvas.
Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.