码迷,mamicode.com
首页 >  
搜索关键字:preorder    ( 600个结果
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 / 3 return [1,2,3]. Note: Recurs...
分类:其他好文   时间:2014-09-02 17:50:45    阅读次数:136
Binary Tree Preorder Traversal
二叉树前序遍历非递归实现。...
分类:其他好文   时间:2014-09-01 22:49:43    阅读次数:181
[leecode]Binary Tree Preorder Traversal
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:其他好文   时间:2014-08-31 18:34:41    阅读次数:180
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
【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-08-20 14:01:43    阅读次数:202
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 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
二叉树非递归遍历
1.非递归先序遍历要点:总是先访问根root,而将root的右结点压入栈中,当root没有左结点时,取出栈顶元素给root。void preorder(node* root){ if(root==NULL) return; stack s; while(true){ ...
分类:其他好文   时间:2014-08-16 12:19:30    阅读次数:171
Binary Tree Preorder Traversal
#define NULL 0class Solution {public: vector preorderTraversal(TreeNode *root) { stack s; vector v1; if(root!=NULL) s.p...
分类:其他好文   时间:2014-08-14 13:35:48    阅读次数:210
600条   上一页 1 ... 53 54 55 56 57 ... 60 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!