码迷,mamicode.com
首页 >  
搜索关键字:preorder traversal    ( 1851个结果
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
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 ...
分类:其他好文   时间:2014-08-17 18:25:02    阅读次数:233
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
Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,...
分类:其他好文   时间:2014-08-17 15:32:12    阅读次数:131
Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For e...
分类:其他好文   时间:2014-08-17 15:31:52    阅读次数:221
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
二叉树非递归遍历
1.非递归先序遍历要点:总是先访问根root,而将root的右结点压入栈中,当root没有左结点时,取出栈顶元素给root。void preorder(node* root){ if(root==NULL) return; stack s; while(true){ ...
分类:其他好文   时间:2014-08-16 12:19:30    阅读次数:171
LeetCode——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 / 3 return [1,3,2]. Note: Recursive solutio...
分类:其他好文   时间:2014-08-16 11:15:00    阅读次数:227
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!