Exemplo n.º 1
0
 def insert_head(self, value):
     """"""
     # inserting at head
     x = Node(value)
     x.child = self.head
     if self.head:
         self.head.parent = x
     self.head = x
     x.parent = None
Exemplo n.º 2
0
 def push(self, num: int):
     node = Node(num)
     node.parent = self._tail
     self.addNode(node)