29.5k views
2 votes
In an array based implementationof a queue a possible solution to dealing with the full condition is to

A. All other answers

B. Check for frontIndex equal to backIndex

C.wait for an arrayFullException to be thrown

D. Maintain a count of queue items

User Zawadi
by
5.8k points

1 Answer

5 votes

Answer:

D. Maintain a count of queue items.

Step-by-step explanation:

For checking the full condition of a queue you have to check whether the number of elements in the array are equal to the size of the array.If they are equal then we can that the queue is full.

Checking frontindex equal to backindex is for checking if the queue is empty.

In option C we have to check for arrayFullException but it will not be a good approach.

So we conclude by saying that the answer is option D.

User Robertokl
by
6.0k points