Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. Circ ular queue array implementation is used for QueueClass. Suppose that a e

ID: 3706560 • Letter: 2

Question

2. Circ ular queue array implementation is used for QueueClass. Suppose that a eclass object of maximum size 40. Suppose the value of queueFront is 31 and the value of queueRear is 9 a) What is the queue size (number of elements actually in the queue)? b) If fifteen at the front are removed from this queue, what is the value of queueFront and the value of queueRear? c) Three String objects "Red", "Green", "Blue" are added in sequence Which slots of the array (partially shown below) will them be at, respectively? I6]7 8] 191 101 1 12] 13] d) What are the values of queueFront and the value of queueRear after adding these three in the queue in part c)?

Explanation / Answer

Solution:

a)

The size of the queue is

queueRear-queueFront+1 = 31-9+1 = 23

b)

then the queueFront will remain 31 and queueRear will become 8

c)

[6]= "Red"

[7]= "Green"

[8]= "Blue"

d)

queueFront= 6

queueRear= 8

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)