Answer:
Check the explanation
Explanation:
Answer: Solution: Algorithm:
Step 1: Start.
Step 2: Create a stack Step
3: Push an initial stack variable, it will represent that, stack is empty.
Step 4: Get input
If +1 then push "+1"
Else if -1 then pop
Step 5: Repeat until all input finish or Stop if empty stack variable popped. Step 6: Stop.
It is a pushdown automata problem.
It can be also represented as:
X =1+1* —1* 1No(+1)>= No(-1)}