Complete the code to check if the stack is empty.
bool isEmpty() {
return top [1] -1;
}The stack is empty when the top index is equal to -1.
Complete the code to check if the stack is full.
bool isFull() {
return top [1] maxSize - 1;
}The stack is full when the top index equals maxSize - 1.
Complete the code to check if the stack is empty.
bool isEmpty() {
return top [1] -1;
}The stack is empty when the top index is equal to -1.
Fill both blanks to correctly check if the stack is full.
bool isFull() {
return top [1] maxSize [2] 1;
}The stack is full when top equals maxSize minus 1, so use '==' and '-' operators.
Fill all three blanks to implement a function that returns true if the stack is empty or full.
bool isEmptyOrFull() {
return (top [1] -1) || (top [2] maxSize [3] 1);
}The stack is empty if top == -1, and full if top == maxSize - 1. So use '==' for both comparisons and '-' to subtract 1.
