原文:[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. 这道题要求从中序和后序遍历的结果来重建原二叉树,我们知道中序的遍历顺序是左 根 右,后序的顺序是左 右 根,对于这种树的 ...

2015-02-19 17:29 4 10393 推荐指数:

查看详情

[leetcode]Construct Binary Tree from Preorder and Inorder Traversal

从前序中遍历来重构二叉树 经典题,从期末考试到考研什么的应该都有 前序遍历第一个肯定是root 在inorder里面去找root 左边的是leftsubtree , 右边的是rightsubtree 然后preorder除去order,后面lifetsubtree.size ...

Wed Jan 15 01:20:00 CST 2014 0 2505
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM