Question
C++ Programming 1. Suppose that stack is an object of type stackType . What is the difference between stack.top and stack.top - 1 ? 2.
C++ Programming
1. Suppose that stack is an object of type stackType
2. Explain why, in the linked implementation of a stack, it is not necessary to implement the operation to determine whether the stack is full.
3. What does the following function do?
void mystery(queueType& q) {
stackType
while (!q.isEmptyQueue()) { s.push(q.front()); q.deleteQueue(); }
while (!s.isEmptyStack()) { q.addQueue(2 * s.top()); s.pop(); }
4. Suppose that queue is a queueType object and the size of the array implementing queue is 100. Also, suppose that the value of queueFront is 99 and the value of queueRear is 25.
a. What are the values of queueFront and queueRear after adding an element to queue?
b.What are the values of queueFront and queueRear after removing an element from queue?
5. Suppose that queue is a queueType object and the size of the array implementing queue is 100. Also, suppose that the value of queueFront is 99 and the value of queueRear is 99.
a. What are the values of queueFront and queueRear after adding an element to queue?
b. What are the values of queueFront and queueRear after removing an element from queue?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started