Question - What is a queue in data structure?
Answer -
A queue is a linear data structure that supports a specific order in which operations are performed. The order is FIFO (First in First Out) methodology, i.e., data items stored first will be accessed first. Unlike stack, the queue is open at both ends, and one end is always used to insert data and another one to remove data.
The basic operations associated with queues -
- Dequeue - To remove an item
- Enqueue - To insert an item
- isempty() − Confirms whether the queue is empty.
- isfull() − Confirms whether the queue is full.
- peek() − Gets the element at the front of the queue without removing it.