The queue data structure follows the FIFO (First In First Out) principle where elements that are added first will be removed first.
Operations performed by Queue are:-
-
enque() inserts an element at the back of the queue
-
deque () removes an element from the front of the queue
-
getFront() returns the first element of the queue
-
getBack() returns the last element of the queue
-
size() returns the number of elements in the queue
-
empty() returns true if the queue is empty