def enqueueBack(self,val): if not self.__tail: self.__tail=self.__head=Node(val) else: temp=Node(val) self.__tail.Next=temp temp.Prev=self.__tail self.__tail=temp
def insert(self,x): if self.__head: cur=self.__head while cur.Next: cur=cur.Next temp=Node(x) temp.Prev,cur.Next,self.__tail=cur,temp,temp else: self.__tail=self.__head=Node(x) DL.__size+=1