码迷,mamicode.com
首页 >  
搜索关键字:inorder    ( 706个结果
[leetcode]Binary Tree InorderTraversal
Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:其他好文   时间:2014-08-31 18:27:01    阅读次数:168
39. Recover Binary Search Tree && Validate Binary Search Tree
思想: Morris traversal. Solution 1 : Preorder traversal Solution 2: Inorder traversal. Solution 3: Morris Traversal.
分类:其他好文   时间:2014-08-27 20:25:48    阅读次数:273
36. Construct Binary Tree from Inorder and Postorder Traversal && Construct Binary Tree from Preorder and Inorder Traversal
思想: 迭代。 说明: 这类问题,要求一个提供根节点,然后另一个序列(中序序列)可依据根节点分出左右子树。
分类:其他好文   时间:2014-08-27 20:20:38    阅读次数:198
37. Binary Tree Zigzag Level Order Traversal && Binary Tree Inorder Traversal
思路: 使用两个队列(一个可以顺序读,所以用vector模拟),每个队列放一层结点。 题解: 两种方法: 1. 使用栈: O(n) Time, O(n) Space。 2. Morris traversal (构造线索树), O(n) Time, O(1) Space.
分类:其他好文   时间:2014-08-27 20:16:18    阅读次数:227
【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. 思路:和上一题一样,后续我们可以通过最后一个值得到根的值,同样可以通过定位根的值得到左右子树的...
分类:其他好文   时间:2014-08-21 17:22:24    阅读次数:138
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 / 3return [1,3,2]....
分类:其他好文   时间:2014-08-18 23:29:53    阅读次数:254
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-08-17 16:54:02    阅读次数:160
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.思路:利用后序遍历提供的根节...
分类:其他好文   时间:2014-08-17 16:52:12    阅读次数:228
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. 1 class Solut...
分类:其他好文   时间:2014-08-17 01:03:21    阅读次数:199
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-08-16 23:48:31    阅读次数:333
706条   上一页 1 ... 62 63 64 65 66 ... 71 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!