This post is about detecting if the brackets in a string are balanced, this problem is usually a sub problem of expression conversion (infix, prefix, postfix) using stack. In the following program we traverse the string and search for the opening bracket if an opening bracket is found then we push it on the stack and if the closing bracket is found then we pop the stack and compare if they are the same type of opening and closing brackets if yes then we continue else we stop.
You might also be interested in
Singly Linked List
Double Linked List
Linked List in Python
Infix to Prefix Conversion
Infix to Postfix Conversion
Binary Search Tree
C++ Program
You might also be interested in
Singly Linked List
Double Linked List
Linked List in Python
Infix to Prefix Conversion
Infix to Postfix Conversion
Binary Search Tree
Comments
Post a Comment