码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
[LeetCode] Binary Tree Preorder Traversal 二叉树的先序遍历
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not...
分类:其他好文   时间:2014-12-05 17:07:57    阅读次数:179
Binary Tree post order traversal
One: Using two stacks, stack to traversal the node, stackr to record the parent node when visiting its right-child; https://oj.leetcode.com/problems.....
分类:其他好文   时间:2014-12-05 00:30:18    阅读次数:158
[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. 简单的思想:正序排列时,某节点的右节点一定是该节点的右子树,中序排列,某节点的左节点一定是该节点的左子树; ...
分类:其他好文   时间:2014-12-04 18:03:12    阅读次数:143
LeetCode: Binary Tree Inorder Traversal 解题报告
Binary Tree Inorder TraversalGiven a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3...
分类:其他好文   时间:2014-12-04 00:52:08    阅读次数:191
LeetCode: Binary Tree Preorder Traversal 解题报告
Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 ...
分类:其他好文   时间:2014-12-03 23:14:20    阅读次数:163
LeetCode[Tree]: 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. 这类问题非常适合用递归做,递归思路如下: 前序遍历的第一个节点必然是根节点,中序遍历中根节点之前的节...
分类:其他好文   时间:2014-12-03 21:27:24    阅读次数:172
Binary Tree Level Order Traversal II
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:其他好文   时间:2014-12-03 21:09:03    阅读次数:119
【LeetCode】Binary Tree Inorder Traversal (2 solutions)
Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:其他好文   时间:2014-12-02 22:10:23    阅读次数:138
LeetCode:Binary Tree Zigzag Level Order Traversal
题目描述: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Gi...
分类:其他好文   时间:2014-12-01 10:12:10    阅读次数:207
【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...
分类:其他好文   时间:2014-11-30 16:46:40    阅读次数:150
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!