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].](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66efdee3ea6c8_19566efdee36acdd.jpg)
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
Get step-by-step solutions from verified subject matter experts
