I want this program to recursively solve this using a stack implementation with push and pop. I have the push and pop done, as well as these functions:
A string the users enter can only be made up of these characters. Any other characters and it returns unbalanced.
'(', ')', '{', '}', '[', ']'
An example of a balanced string is like this
()
(())
()()
{()()}
[]
[()[]{}]()
etc..
An unbalanced string looks like this:
{}}
()[}
[()}
etc..
This is the recursive definition of a balanced string:
- (BASIS)The empty string is balanced
- (NESTING) If s is also a balanced string then (s), [s], and {s} is balanced.
- (CONCATENATION) If A and B are both strings, then AB is also balanced.
I do not know what my base case would be or how to implement this in recursion. I can without but I want to learn recursion. Any help?