コード例 #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
コード例 #2
0
ファイル: Stack.py プロジェクト: aerotog/ctci_must_knows
 def push(self, num: int):
     node = Node(num)
     node.parent = self._tail
     self.addNode(node)