Question: 2. Consider an initially empty queue Q stored in array 2[0..5]. Assume that FRONT and REAR pointers are all initialized to-1 ENQUEUE(Q, 1), ENQUEUE(Q, 3),

 2. Consider an initially empty queue Q stored in array 2[0..5].

2. Consider an initially empty queue Q stored in array 2[0..5]. Assume that FRONT and REAR pointers are all initialized to-1 ENQUEUE(Q, 1), ENQUEUE(Q, 3), DEQUEUE(Q), ENQUEUE(Q, 8), and DEQUEUE(Q). Here, ENQUEUE refers to inserting an element into the queue, and DEQUEUE refers to removing an element from the queue. Indicate where the FRONT and REAR pointers are. (b) Now, assume that the array is circular, i.e., the array wraps around. Also, assume that we double the queue size (using realloc) when the queue is full. Show the contents of the array (with resizing if necessary) when another four operations are then performed: ENQUEUE Q, 14), ENQUEUE Q, 11), ENQUEUE(Q, 13), ENQUEUE(Q, 18). Indicate where the FRONT and REAR pointers are

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!