3.7k views
4 votes
3. When does a data type not implement the Queue API? Mark all that apply. When the maximum size of the queue needs to be specified ahead of time When the only operations that change the queue are to insert an item and to remove the least recently inserted item When the order of growth of the time required to enqueue an item is logarithmic When the space required cannot be bounded by a constant times the number of items in the queue at all times When the only operations that change the queue are to insert an item and to remove the most recently inserted item When the operation of removing an arbitrary item is supported

User FutureJJ
by
7.8k points

1 Answer

5 votes

Final answer:

A data type does not implement the Queue API when the maximum size of the queue needs to be specified ahead of time, the only operations that change the queue are to insert an item and to remove the least recently inserted item, or when the space required cannot be bounded by a constant times the number of items in the queue at all times.

Step-by-step explanation:

A data type does not implement the Queue API when:

  • The maximum size of the queue needs to be specified ahead of time
  • The only operations that change the queue are to insert an item and to remove the least recently inserted item
  • The space required cannot be bounded by a constant times the number of items in the queue at all times

When any of these conditions are met, the data type does not adhere to the standard Queue API.

User Duarte Nunes
by
7.6k points