摘要:
题目: 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). 阅读全文
摘要:
题目; Given inorder and postorder traversal of a tree, construct the binary tree. 题意及分析:给出棵二叉树的中序遍历和后续遍历,求这棵树。同用先序和中序推二叉树,不同的点是,后序遍历的最后一个点才是根节点。 代码: 阅读全文
摘要:
题目: Given preorder and inorder traversal of a tree, construct the binary tree. 题意及分析:给出一棵树的先序遍历和中序遍历,要求给出给出该二叉树。先序遍历第一个节点肯定是根节点,那么这样就可以利用中序遍历找出树的左右子树, 阅读全文