Question: Use C++ Stack class to solve the Balancing Symbols problem. The symbols are (), [], and {}, and each opening symbol must have a corresponding
Use C++ Stack class to solve the "Balancing Symbols" problem. The symbols are (), [], and {}, and each opening symbol must have a corresponding closing symbol as well as in correct order. Ignore operands and arithmetic operators since they are not relevant to our problem. You can assume each token is a single character and separated by spaces.
For example: { ( a + b ) * c } valid
{ ( a + b ) * c ] invalid
( ( a + b ) * c } / 5 ) invalid
Lab question 1: Outline a solution to handle an expression like {(a+25 )*c1}. Notice that spaces are optional and each token can be more than one character.
Implement a Queue ADT using a circular array with 5 string elements.
Create some Queue objects and try various operations.
Queue myQueue;
myQueue.enqueue(CSCI 140);
myQueue.enqueue(CSCI 220);
myQueue.enqueue(CSCI 230);
myQueue.dequeue();
myQueue.enqueue(CSCI 110);
myQueue.enqueue(CSCI 150);
myQueue.enqueue(CSCI 145);
string course = myQueue.front(); // course should be CSCI 220
Lab question 2: Draw a diagram showing the queue above after all the operations.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
