Queue is a linear data structure represented in One Dimensional ( 1D ) array. Queue follows principle of FIFO ( First In First Out ). So the first item, that is item at "Front" is serviced first and remove first. The new item will be added after the last item at "Rear" and change the position of "Rear" to new item added.
There are two operations that can be done in queue.
There are two operations that can be done in queue.
- Insert
- Delete
Insertion operation also called en-queuing and deletion also called de-queuing .
Queue have disadvantage that the queue checks only one condition to check whether queue is full or not. The condition is "Rear = Size". But it is not checking whether the queue is physically full or not. This disadvantage leads another implementation of queue called "Circular queue".
Implementation of queue: http://terminalcoders.blogspot.in/2014/07/queue-implementation-cpp.html
Implementation of queue: http://terminalcoders.blogspot.in/2014/07/queue-implementation-cpp.html