码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
[LeetCode]103 Binary Tree Zigzag Level Order Traversal
https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/24509105/** *Definitionforbinarytree *publicclassTreeNode{ *intval; *TreeNodeleft; *TreeNoderight; *TreeNode(intx){val=x;} *} */ publi..
分类:其他好文   时间:2015-01-06 12:07:28    阅读次数:147
LeetCode:Construct Binary Tree from Preorder and Inorder Traversal
题目描述: Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 解题思路:先序遍历的第一个元素为根元素,在中序遍历序列中找到根元素的位置。中...
分类:其他好文   时间:2015-01-06 11:58:44    阅读次数:159
[leetcode] Construct Binary Tree from Preorder and Inorder Traversal
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Defini...
分类:其他好文   时间:2015-01-06 07:09:29    阅读次数:207
[LeetCode]94 Binary Tree Inorder Traversal
https://oj.leetcode.com/problems/binary-tree-inorder-traversal/http://blog.csdn.net/linhuanmars/article/details/20187257/** *Definitionforbinarytree *publicclassTreeNode{ *intval; *TreeNodeleft; *TreeNoderight; *TreeNode(intx){val=x;} *} */ publicclassSolut..
分类:其他好文   时间:2015-01-05 18:57:54    阅读次数:133
【leetcode】Binary Tree Level Order Traversal
每日一练,Givenabinarytree,returnthelevelordertraversalofitsnodes‘values.(ie,fromlefttoright,levelbylevel).Forexample:Givenbinarytree{3,9,20,#,#,15,7},3 /920 /157returnitslevelordertraversalas:[ [3], [9,20], [15,7] ]代码如下:classSolution{ public: in..
分类:其他好文   时间:2015-01-05 07:06:51    阅读次数:165
LeetCode: Construct Binary Tree from Inorder and Postorder Traversal 解题报告
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:其他好文   时间:2015-01-03 17:18:44    阅读次数:136
LeetCode: Construct Binary Tree from Preorder and Inorder Traversal 解题报告
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:其他好文   时间:2015-01-03 00:53:53    阅读次数:235
leetcode-Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. class Solution { private: TreeNode *root; v...
分类:其他好文   时间:2015-01-02 09:46:36    阅读次数:107
[LeetCode]145 Binary Tree Postorder Traversal
https://oj.leetcode.com/problems/binary-tree-postorder-traversal/http://blog.csdn.net/ljphhj/article/details/21369053/** *Definitionforbinarytree *publicclassTreeNode{ *intval; *TreeNodeleft; *TreeNoderight; *TreeNode(intx){val=x;} *} */ publicclassSolution..
分类:其他好文   时间:2015-01-02 07:33:36    阅读次数:132
[leetcode] Binary Tree Postorder Traversal
题目:(Tree ,Stack)Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3...
分类:其他好文   时间:2015-01-01 07:54:28    阅读次数:116
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!