Queue is data structure where you can traverse through node in one direction. Queue follows FIFO (First In First Out) structure. If an element is added to the queue, it will also be the removed first from the queue.

General Idea:

Each node in a queue is connected with each other with a uni-directional edges. We use pointers head & tail to perform insert/delete operations in a queue. A pointer next is used by each node to point to the next node in the queue.


Insert : We add an element to the end/tail of queue
Delete : We delete from the head/start of the queue
Peek : We can check what is the first element of queue using peek
Traverse: We traverse from head/start to tail/end of the queue