Given a binary tree, return the postorder traversal of its nodes’ values.For example:
Given binary tree {1,#,2,3},
return [3,2,1].Note: Recursive solution is trivial, could you do it iteratively?...
分类:
其他好文 时间:
2015-02-24 07:02:03
阅读次数:
180
Given a binary tree, return the preorder traversal of its nodes’ values.For example:
Given binary tree {1,#,2,3},
return [3,2,1].Note: Recursive solution is trivial, could you do it iteratively?递归...
分类:
其他好文 时间:
2015-02-24 01:53:20
阅读次数:
192
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2015-02-22 06:46:02
阅读次数:
162
Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:
其他好文 时间:
2015-02-21 15:26:40
阅读次数:
185
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.这道题要求用先序和中序遍历来建...
分类:
其他好文 时间:
2015-02-20 14:08:33
阅读次数:
169
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-02-19 18:37:40
阅读次数:
221
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.[Solution]后序定根...
分类:
其他好文 时间:
2015-02-18 11:50:07
阅读次数:
129
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.[Solution]先序定根,...
分类:
其他好文 时间:
2015-02-18 11:47:49
阅读次数:
151
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2015-02-17 19:53:57
阅读次数:
197
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
这道题要求根据二叉树的前序遍历序列和中序遍历序列构建二叉树。
举个例子:
前序序列:A B D E F C...
分类:
其他好文 时间:
2015-02-14 13:48:00
阅读次数:
145