Computer scienceAlgorithms and Data StructuresData structuresLimited access data types

Circular queue

Familiar situation

Report a typo

Suppose a circular queue is in the following state:

Full circular queue

For some reason, you have to perform the following operation: enqueue 10. In what position should the newly added 10 appear in the queue above?

If:

  • the circular queue cannot be in the state represented in the image, output 100
  • nothing happens after we perform the operation, output 10
  • an error occurs, output -1
  • the output depends on other factors and can't be determined for sure, output -10.
Enter a number
___

Create a free account to access the full topic