Your code

Report a typo

Arrange the pseudocode pieces of the enqueue function in the queue in the correct order.

Keep in mind:

  • queue is a queue-type object;
  • element is an integer that we add to the queue;
  • rearrepresents the index of the last queue's position;
  • maximum_size defines the maximum capacity of a queue.
Put the items in the correct order
if (size(queue) != maximum_size) then
queue[rear+1] = element
function enqueue(int element):
rear= (rear+ 1) % maximum_size
___

Create a free account to access the full topic