acm.hdu.edu.cn/showproblem.php?pid=1710 【题意】 给定一棵二叉树的前序遍历和中序遍历,输出后序遍历 【思路】 根据前序遍历和中序遍历递归建树,再后续遍历输出 malloc申请空间在堆,函数返回,内存不释放,需要free手动释放 【Accepted】 #incl ...
分类:
其他好文 时间:
2018-06-13 00:14:27
阅读次数:
150
原题网址:https://www.lintcode.com/problem/invert-binary-tree/description 描述 翻转一棵二叉树 描述 描述 翻转一棵二叉树 翻转一棵二叉树 翻转一棵二叉树 您在真实的面试中是否遇到过这个题? 是 样例 1 1 / \ / \ 2 3 = ...
分类:
其他好文 时间:
2018-06-12 22:28:45
阅读次数:
201
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4010 题意; 先给你一棵树,有 $4$ 种操作: 1、如果 $x$ 和 $y$ 不在同一棵树上则在xy连边. 2、如果 $x$ 和 $y$ 在同一棵树上并且 $x!=y$ 则把 $x$ 换为树根并把 ...
分类:
其他好文 时间:
2018-06-12 19:44:03
阅读次数:
175
完全二叉树的性质 定义 满二叉树 : 一棵深度为k,且有 $2^{k+1} 1$ 个节点的二叉树,称为满二叉树(Full Binary Tree)。 这种树的特点是每一层上的节点数都是最大节点数。 完全二叉树 : 而在一棵二叉树中,除最后一层外,若其余层都是满的,并且最后一层或者是满的,或者是在右边 ...
分类:
其他好文 时间:
2018-06-12 13:32:54
阅读次数:
204
问题描述: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For exa ...
分类:
其他好文 时间:
2018-06-12 10:28:27
阅读次数:
204
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: "http://codeforces.com/contest/985/problem/E" Description Mis ...
分类:
其他好文 时间:
2018-06-11 10:52:14
阅读次数:
143
描述The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total n ...
分类:
编程语言 时间:
2018-06-11 01:59:16
阅读次数:
175
关系型数据库管理系统(RDBMS): RDBMS 术语: 数据库: 数据库是一些关联表的集合。 数据表: 表是数据的矩阵。在一个数据库中的表看起来像一个简单的电子表格。 列: 一列(数据元素) 包含了相同的数据, 例如邮政编码的数据。 行:一行(=元组,或记录)是一组相关的数据,例如一条用户订阅的数 ...
分类:
数据库 时间:
2018-06-10 15:12:46
阅读次数:
186
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r... ...
分类:
其他好文 时间:
2018-06-10 12:05:54
阅读次数:
128