Fill This Form To Receive Instant Help
Homework answers / question archive / Suppose that queue is a queueType object and the size of the array implementing queue is 100
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?
6. Suppose that queue is implemented as an array with the special reserved slot. Also suppose that the value of queueFront is 74 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 value of queueFront and queueRear after removing an element from the queue? Also what was the position of the removal queue element?
please see the attached file.
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?
Answer: queueFront is 99, queueRear is 26
Explanation.
Head of queue is at 99, tail at 25.
Items are enqueued at the tail; therefore tail will be increased by one, head is not changed.
b. What are the values of queueFront and queueRear after removing an element from queue?
Answer: queueFront is 0, queueRear is 25
6. Suppose that queue is implemented as an array with the special reserved slot. Also suppose that the value of queueFront is 74 and the value of queueRear is 99.
a. What are the values of queueFront and queueRear after adding an element to queue?
Answer: queueFront is 74, queueRear is 0
b. What are the value of queueFront and queueRear after removing an element from the queue? Also what was the position of the removal queue element?
Answer: queueFront is 75, queueRear is 99
Also what was the position of the removal queue element?: 74
Note: When is the full? When ( (rear+1) % MAX == front) (one free slot left)