implementing queue with singly linked list as we did for the stack adtwe can use singly linked list to implement the queue adt while supporting worst-case ( )-time for all operations because we need to perform operations on both ends of the queuewe will explicitly maintain both head reference and tail reference as instance variables for each queue the natural orientation for queue is to align the front of the queue with the head of the listand the back of the queue with the tail of the listbecause we must be able to enqueue elements at the backand dequeue them from the front (recall from the introduction of section that we are unable to efficiently remove elements from the tail of singly linked list our implementation of linkedqueue class is given in code fragments and class linkedqueue """fifo queue implementation using singly 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 "" self head none 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 = def first(self) """return (but do not removethe element at the front of the queue "" if self is empty) raise emptyqueue is empty front aligned with head of list return self head element code fragment implementation of queue adt using singly linked list (continued in code fragment