Binary Tree Postorder TraversalGiven a binary tree, return thepostordertraversal of its nodes' values.Given binary tree{1,#,2,3}, 1 \ 2 / ...
分类:
其他好文 时间:
2015-11-17 06:49:39
阅读次数:
158
题意: 用迭代法输出一棵二叉树的后序遍历结果。思路: (1)用两个栈,一个存指针,一个存标记,表示该指针当前已经访问过哪些孩子了。 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int ...
分类:
其他好文 时间:
2015-11-02 22:39:45
阅读次数:
259
题目:Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1]...
分类:
其他好文 时间:
2015-10-09 18:19:44
阅读次数:
136
LeetCode -- Construct Binary Tree from Inorder and Postorder Traversal...
分类:
其他好文 时间:
2015-10-04 17:16:45
阅读次数:
128
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.struct TreeNod...
分类:
其他好文 时间:
2015-10-04 14:45:11
阅读次数:
139
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.遇到二叉树问题最先想到的是递...
分类:
其他好文 时间:
2015-10-03 18:16:44
阅读次数:
200
Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,...
分类:
其他好文 时间:
2015-10-03 18:13:25
阅读次数:
214
Postorder: first, visit left child, then, parent, last, is to visit right child.The postorder traversal result of above tree is {4,6,5,2,3,1}.Key diff...
分类:
其他好文 时间:
2015-10-01 06:59:04
阅读次数:
195
#include#include#includeusing namespace std;const int MAX_N=10005;vector G[MAX_N]; vector rG[MAX_N];//存储边反向之后的图 vector PostOrder;//存储图的后序遍历 int V,E;bo...
分类:
其他好文 时间:
2015-09-22 12:53:55
阅读次数:
143
Binary Tree Postorder TraversalGiven a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \...
分类:
编程语言 时间:
2015-09-19 22:25:13
阅读次数:
194