Dynamic Queue Simulation

Queue Data Structures Simulation

Dynamic Queue Simulation

Write a function that simulates basic queue operations. The function will receive an array (or list) of string commands and must return an array (or list) containing the results of each dequeue operation.

The commands are as follows:

  • ENQUEUE x: Insert element x (a string or integer) into the queue.
  • DEQUEUE: Remove the element at the front of the queue and record its value. If the queue is empty when a dequeue is attempted, record the string EMPTY.

Example:

Given the commands: ["ENQUEUE 5", "ENQUEUE 10", "DEQUEUE", "DEQUEUE", "DEQUEUE"], the simulation should return [5, 10, "EMPTY"].

You can assume that each command is correctly formatted. This problem gives you a chance to practice simulating a data structure using simple operations. As an extra twist, imagine this simulation is part of a system managing customer service requests on April 9th, a day when many organizations reevaluate their process efficiencies.

Implement your solution to pass any valid test case with a list of commands.

Function Signature:

For example, in Python:

# Input: List of command strings
# Output: List of results for each DEQUEUE operation

def simulate_queue_operations(commands):
    pass  # Implement your solution here