queue model the basic operations on queue are enqueuewhich inserts an element at the end of the list (called the rear)and dequeuewhich deletes (and returnsthe element at the start of the list (known as the frontfigure shows the abstract model of queue array implementation of queues as with stacksany list implementation is legal for queues like stacksboth the linked list and array implementations give fast ( running times for every operation the linked list implementation is straightforward and left as an exercise we will now discuss an array implementation of queues for each queue data structurewe keep an arraythearrayand the positions front and backwhich represent the ends of the queue we also keep track of the number of elements that are actually in the queuecurrentsize the following table shows queue in some intermediate state front back the operations should be clear to enqueue an element xwe increment currentsize and backthen set thearray[backx to dequeue an elementwe set the return value to thearray[front]decrement currentsizeand then increment front other strategies are possible (this is discussed laterwe will comment on checking for errors presently there is one potential problem with this implementation after enqueuesthe queue appears to be fullsince back is now at the last array indexand the next enqueue would be in nonexistent position howeverthere might only be few elements in the queuebecause several elements may have already been dequeued queueslike stacksfrequently stay small even in the presence of lot of operations the simple solution is that whenever front or back gets to the end of the arrayit is wrapped around to the beginning the following tables show the queue during some operations this is known as circular array implementation dequeue figure model of queue queue enqueue