码迷,mamicode.com
首页 >  
搜索关键字:postorder    ( 397个结果
[LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.方法:在inorder中寻找...
分类:其他好文   时间:2014-07-07 23:18:53    阅读次数:283
Problem Binary Tree Postorder Traversal
Problem Description:Given a binary tree, return thepostordertraversal of its nodes' valuesSolution: 1 public List postorderTraversal(TreeNode root) { ...
分类:其他好文   时间:2014-07-07 16:45:23    阅读次数:177
[Leetcode][Tree][Construct Binary Tree from Preorder/Postorder and Inorder Traversal ]
从树的中序遍历+前/后序遍历重建一棵树。必须使用iterator才能过,否则会MLE。1、preorder + inorder第一个版本,使用坐标范围: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int...
分类:其他好文   时间:2014-07-07 14:11:10    阅读次数:147
Leetcode Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.class Solution...
分类:其他好文   时间:2014-07-03 20:25:21    阅读次数:219
[leetcode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.
分类:其他好文   时间:2014-07-03 19:13:08    阅读次数:187
DFS & BFS
DFS 深度优先BFS 广度优先DFS或者BFS都是在联通区域内遍历节点的方法用在二叉树上DFS有preOreder,inOrder,postOrder,BFS就是层次遍历。在二叉树上的节点,只有两个选择,left 和right,即,对于每一个节点,in 有1个, out 有两个,有向图在矩阵的节点...
分类:其他好文   时间:2014-07-01 21:32:46    阅读次数:278
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: Rec...
分类:其他好文   时间:2014-07-01 07:06:11    阅读次数:214
[Leetcode][Tree][Binary Tree Postorder Traversal]
二叉树的后续遍历1、递归版本/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :...
分类:其他好文   时间:2014-06-30 14:17:28    阅读次数:306
LeetCode: Binary Tree Postorder Traversal [145]
【题目】 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 trivial, could you do it iteratively? 【题意】 非递归实现后续遍...
分类:其他好文   时间:2014-06-30 10:10:10    阅读次数:177
leetcode题解:Binary Tree Postorder Traversal (二叉树的后序遍历)
题目:Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1]...
分类:其他好文   时间:2014-06-26 15:59:16    阅读次数:207
397条   上一页 1 ... 36 37 38 39 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!