Question: USING THE C++ CODE BELOW, CAN YOU PLEASE SOLVE THE QUESTION AND EXPLAIN THE STEPS. class StaticStack { private : int *stack; int capacity; int
USING THE C++ CODE BELOW, CAN YOU PLEASE SOLVE THE QUESTION AND EXPLAIN THE STEPS.
class StaticStack
{
private:
int *stack;
int capacity;
int top; // index of the top element
public:
StaticStack(int size); // constructor
~StaticStack();
bool isFull();
bool isEmpty();
void push(int);
int pop();
};
#include "StaticStack.h"
#include
using namespace std;
StaticStack::StaticStack(int size)
{
stack = new int[size]; // constructing a size sized array
capacity = size;
top = -1; // empty stack
}
StaticStack::~StaticStack()
{
delete [] stack;
}
bool StaticStack::isFull()
{
return (top == capacity -1);
}
bool StaticStack::isEmpty()
{
return (top == -1);
}
void StaticStack::push(int data)
{
if (isFull())
{
cout
}
else
{
top++;
stack[top] = data; // Generally -> keep careful because stuff on the right is assigned to stuff on the left
}
}
int StaticStack::pop()
{
int num = 0;
if (isEmpty())
cout
else
{
top--;
num = stack[top+1];
}
return num;
}

2. (Gaddis Exercises 18.15) Balanced Multiple Delimiters A string may use more than one type of delimiter to bracket information into blocks. For example, A string may use braces3, parentheses (), and brackets [ ] as delimiters. A string is properly delimited if each right delimiter is matched with a preceding left delimiter of the same type in such a way that either the resulting blocks of information are disjoint, or one of them is completely nested within the other. Write a program that uses a single stack to check whether a string containing braces, parentheses, and brackets is properly delimited
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
