Operations on Queue in Data Structures

Queue is First In First Out data structure. The queue is used in different area for graph traversal algorithms Breadth First Search etc. The queue has some primitive operations. Here we will see those operations of queue, and see one example using the queue ADT.

The ADT (abstract datatype) is special kind of datatype, whose behavior is defined by a set of values and set of operations. The keyword “Abstract” is used as we can use these datatypes, we can perform different operations. But how those operations are working that is totally hidden from the user. The ADT is made of with primitive datatypes, but operation logics are hidden.

These are few operations or functions of the queue ADT.

  • isFull(), This is used to check whether queue is full or not
  • isEmpry(), This is used to check whether queue is empty or not
  • enqueue(x), This is used to push x at the end of the queue
  • delete(), This is used to delete one element from the front end of the
  • front(), This is used to get the front most element of the queue
  • size(), this function is used to get number of elements present into the queue


 Live Demo

using namespace std;
   queue<int> que;
      cout << "Queue is empty" << endl;
   } else {
      cout << "Queue is not empty" << endl;
   //insert elements into queue
   cout << "Size of the queue: " << que.size() << endl;
   //delete and dispay elements
   while(!que.empty()) {
      int item = que.front(); // read element from first position
      cout << item << " ";


Queue is empty
Size of the queue: 5
10 20 30 40 50