Question
Q2. [10 marks] Answer the following questions about Queues. (i). [5 marks] Assume that we have an empty queue . Given a series of queue
Q2. [10 marks] Answer the following questions about Queues. (i). [5 marks] Assume that we have an empty queue . Given a series of queue operations on as below, write down the element returned by each Deqeue operation and show the final queue. Enqeue(, 3), Enqeue(, 6), Deqeue(), Deqeue(), Enqeue(, 8), Enqeue(, 5), Deqeue(), Enqeue(, 7), Deqeue(). (ii). [5 marks] Suppose that an array of size 8 is used to store a circular queue, and the values of the front and rear are 0 and 5, respectively. Now after 1 dequeue and 3 enqueues, what will the values of the front and rear be?
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