![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
重理解
路漫漫,远修兮
这个作者很懒,什么都没留下…
展开
-
AgainUnderstand_144. Binary Tree Preorder Traversal_路漫漫远修兮
思路一: class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: stack=[] trav=root res=[] while trav or stack: if trav: ...原创 2019-04-24 20:11:20 · 173 阅读 · 0 评论 -
AgainUnderstand_94. Binary Tree Inorder Traversal_路漫漫远修兮
思路一: class Solution: def inorderTraversal(self, root: TreeNode) -> List[int]: res=[] self.centertrave(root,res) return res def centertrave(self,root,res): ...原创 2019-04-24 20:17:41 · 89 阅读 · 0 评论 -
AgainUnderstand_145. Binary Tree Postorder Traversal_路漫漫远修兮
思路一: #这个思路利用了:根右左的顺序遍历二叉树,反过来就是 左右根 即后序遍历了 class Solution(object): def postorderTraversal(self, root): stack, res = [], [] while stack or root: if root: ...原创 2019-04-24 20:25:16 · 136 阅读 · 0 评论 -
AgainUnderstand_102. Binary Tree Level Order Traversal_路漫漫远修兮
思路一: #这个思路还是很清楚的 class Solution(object): def levelOrder(self, root): if not root:return [] stack,queue,res,nCount=[root],[],[[root.val]],1 while stack: temp=s...原创 2019-04-24 20:31:52 · 115 阅读 · 0 评论