Assume you are using the text's array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements and then dequeue 2 elements. Which indices of the internal array elements hold the remaining elements

Respuesta :

The indices of the internal array elements that hold the remaining elements is c) 2 to 4

Calculations and Parameters:

For us to create a capacity of 10 for the queue, we would enqueue:

We would create a queue of capacity 10:

Queue q(10);

We add elements/enqueue 5 elements to the queue :

  • q.queueEnqueue(10);
  • q.queueEnqueue(5);
  • q.queueEnqueue(8);
  • q.queueEnqueue(9);
  • q.queueEnqueue(2);

Printing this would give:

q. queueDisplay()

10, 5, 8, 9, 2

Next, we would remove elements/dequeue 2 elements from the queue :

q. queuedequeue();

q. queuedequeue();

Printing it would be:

q. queueDisplay()

8 ,9, 2

Observing this, the deletion/dequeue starts from the front/first index.

The remaining indices of the internal array elements are: 2, 3, 4 or 2 to 4

Read more about arrays and enqueue here:

https://brainly.com/question/24188935

#SPJ1