A Queue is an Abstract Data Type (ADT) similar to a stack. In contrast to a stack, it is open as both ends. One end is used to insert data (enqueue) and the other end is used to delete data (dequeue).

A Queue to store and retrieve values in a "First-In, First-Out"(FIFO) fashion, i.e. the item which is stored first will be accesses first.

Queues are used when we need to access data items in their exact sequence of arrival. Every operating system maintains queues of various processes. Priority Queues and Breath First traversal of Graphs are some examples of Queues.

Stack Operations Edit

The following operations can be performed on a stack:

  • enqueue() - add an item to the rear of the queue
  • dequeue() - remove an item from the front of the queue
  • peek() - look up the value of the front item without removing it
  • isEmpty() - checks if the queue is empty
  • isFull() - checks if the queue is full

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.