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
def push(self, num: int): node = Node(num) node.parent = self._tail self.addNode(node)