First page Back Continue Last page Graphics
Counting Parentheses
Scan a left parenthesis '('
Scan a right parenthesis ')'
When done:
- If stack is empty, parentheses match!
- If stack is not empty, no match!
- Also, popping an empty stack implies no match!