Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1....
分类:
其他好文 时间:
2015-05-01 17:25:28
阅读次数:
115
做了vijos 1132之后做这题轻松多了,稍微调试了下就ac了,关键就是通过递归去找节点
前+中->后
#include
#include
#define maxn 1000+5
using namespace std;
int n;
int qi[maxn],zh[maxn];
int t=0;
struct root
{
int num;
root *left,*right;
};
...
分类:
其他好文 时间:
2015-05-01 16:09:40
阅读次数:
169
Gray CodeTotal Accepted:32175Total Submissions:98703My SubmissionsQuestionSolutionThe gray code is a binary numeral system where two successive values...
分类:
其他好文 时间:
2015-05-01 14:45:01
阅读次数:
188
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2015-05-01 14:40:44
阅读次数:
125
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
题意:求树的高度。
思路:就是递归。
/**
* Definiti...
分类:
其他好文 时间:
2015-05-01 12:06:48
阅读次数:
163
Latest SQLite binary for January 2015Well I went through quite a few threads to find an updated, decent sqlite binary. Didn't find any that met that c...
分类:
数据库 时间:
2015-05-01 00:33:10
阅读次数:
212
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2015-04-30 19:47:36
阅读次数:
107
二进制类型
包括BINARY、VARBINARY、BIT、TINYBLOB、BLOB、MEDIUMBLOB、LONGBLOB
BINARY(M)类型,保存的是字节而不是字符,没有字符集限制,字节数为M,允许长度为0~M的定长二进制字符串。不足最大指定长度的空间由“\0”补全,查询时也要包含"\0",不然查找不到。进行比较时是按字节进行比较,而不是按字符(char),按字节比较比字符简单快速,...
分类:
数据库 时间:
2015-04-30 18:15:14
阅读次数:
151
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2015-04-30 18:13:52
阅读次数:
137
首先,convert函数字符集转换 : CONVERT(xxx USING gb2312) 类型转换和SQL Server一样,不过类型参数上有不同: CAST(xxx AS 类型), CONVERT(xxx,类型),类型必须用下列的类型: 可用的类型 二进制,同带binary前缀的效果 : B.....
分类:
数据库 时间:
2015-04-30 17:53:45
阅读次数:
142