linked lists implementing queue with circularly linked list to implement the queue adt using circularly linked listwe rely on the intuition of figure in which the queue has head and tailbut with the next reference of the tail linked to the head given such modelthere is no need for us to explicitly store references to both the head and the tailas long as we keep reference to the tailwe can always find the head by following the tail' next reference code fragments and provide an implementation of circularqueue class based on this model the only two instance variables are tailwhich is reference to the tail node (or none when empty)and sizewhich is the current number of elements in the queue when an operation involves the front of the queuewe recognize self tail next as the head of the queue when enqueue is calleda new node is placed just after the tail but before the current headand then the new node becomes the tail in addition to the traditional queue operationsthe circularqueue class supports rotate method that more efficiently enacts the combination of removing the front element and reinserting it at the back of the queue with the circular representationwe simply set self tail self tail next to make the old head become the new tail (with the node after the old head becoming the new head class circularqueue """queue implementation using circularly linked list for storage "" class node """lightweightnonpublic class for storing singly linked node "" (omitted hereidentical to that of linkedstack node def init (self) """create an empty queue ""will represent tail of queue self tail none number of queue elements self size def len (self) """return the number of elements in the queue "" return self size def is empty(self) """return true if the queue is empty "" return self size = code fragment implementation of circularqueue classusing circularly linked list as storage (continued in code fragment