文章 2017-12-04 来自:开发者社区

[LeetCode] Binary Tree Postorder Traversal 二叉树的后序遍历

Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Note: Recursive solution is trivi...

文章 2017-12-03 来自:开发者社区

[LeetCode] Binary Tree Inorder Traversal 二叉树的中序遍历

Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial...

文章 2016-03-19 来自:开发者社区

LeetCode 145 Binary Tree Postorder Traversal(二叉树的后续遍历)+(二叉树、迭代)

版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/50933610 翻译 给定一个二叉树,返回其后续遍历的节点的值。 例如: 给定二叉树为 {1, #, 2, 3...

文章 2016-03-19 来自:开发者社区

LeetCode 144 Binary Tree Preorder Traversal(二叉树的前序遍历)+(二叉树、迭代)

版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/50931535 翻译 给定一个二叉树,返回其前序遍历的节点的值。 例如: 给定二叉树为 {1,#, 2, ...

文章 2016-03-19 来自:开发者社区

LeetCode 94 Binary Tree Inorder Traversal(二叉树的中序遍历)+(二叉树、迭代)

版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/50930671 翻译 给定一个二叉树,返回其中序遍历的节点的值。 例如: 给定二叉树为 {1, #, 2,...

文章 2016-01-22 来自:开发者社区

LeetCode 102 Binary Tree Level Order Traversal(二叉树的层级顺序遍历)(*)

版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/50560214 翻译 给定一个二叉树,返回按层级顺序遍历的每个节点的值。 从左到右,逐层遍历。 例如: ...

文章 2016-01-22 来自:开发者社区

LeetCode 107 Binary Tree Level Order Traversal II(二叉树的层级顺序遍历2)(*)

版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/50560004 翻译 给定一个二叉树,返回从下往上遍历经过的每个节点的值。 从左往右,从叶子到节点。 例...

文章 2014-10-11 来自:开发者社区

LeetCode:94_Binary Tree Inorder Traversal | 二叉树中序遍历 | Medium

题目:Binary Tree Inorder Traversal 二叉树的中序遍历,和前序、中序一样的处理方式,代码见下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* right; 5 TreeNode(int x): val(x), lef...

文章 2014-10-11 来自:开发者社区

LeetCode:144_Binary Tree Preorder Traversal | 二叉树的前序遍历 | Medium

题目:Binary Tree Preorder Traversal 二叉树的前序遍历,同样使用栈来解,代码如下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* right; 5 TreeNode(int x): val(x), left(NUL...

文章 2014-10-11 来自:开发者社区

LeetCode:145_Binary Tree Postorder Traversal | 二叉树后序遍历 | Hard

题目:Binary Tree Postorder Traversal 二叉树的后序遍历,题目要求是采用非递归的方式,这个在上数据结构的课时已经很清楚了,二叉树的非递归遍历不管采用何种方式,都需要用到栈结构作为中转,代码很简单,见下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 ...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

算法编程

开发者社区在线编程频道官方技术圈。包含算法资源更新,周赛动态,每日一题互动。

+关注