Queue is a linear data structure which operates in a First IN First OUT or Last IN Last OUT. Queue is an abstract data type with a bounded (predefined) capacity. It is a simple data structure that allows adding and removing elements in a particular order. The order is FIFO(First IN First OUT) or LILO(Last In Last Out).
It is named queue as it behaves like a real-world queue for examples –
- queue(line) of cars in a single lane,
- queue of people waiting at food counter etc.
- Enqueue() – Add item to the queue from the REAR.
- Dequeue() – Remove item from the queue from the FRONT.
- isFull() – Check if queue is full or not.
- isEmpty() – Check if queue empty or not.
- count() – Get number of items in the queue.
- peek() – return front elemenet in the queue(line).