1 . 二叉树( ( binary .cpp/c/pas)【问题描述】二叉排序树或者是一棵空树,或者是具有下列性质的二叉树:(1)若左子树不空,则左子树上所有结点的值均小于它的根结点的值;(2)若右子树不空,则右子树上所有结点的值均大于它的根结点的值;(3)左、右子树也分别为二叉排序树;(4)没有键 ...
分类:
其他好文 时间:
2017-08-19 18:32:14
阅读次数:
417
Given a 2D binary matrix filled with 0's and 1's, find the largest square which diagonal is all 1 and others is 0. Only consider the main diagonal sit ...
分类:
其他好文 时间:
2017-08-19 14:17:25
阅读次数:
209
Given an undirected weighted graph G, you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E), where V is a ...
分类:
其他好文 时间:
2017-08-19 12:49:00
阅读次数:
163
1 // 十进制转二进制 2 function binary (num, Bits) { 3 var d = parseInt(num / 2) 4 var resArry = [num % 2] 5 for(; d != 0; ) { 6 d = parseInt(d / 2) 7 resArry ...
分类:
Web程序 时间:
2017-08-19 12:48:10
阅读次数:
122
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following mat ...
分类:
其他好文 时间:
2017-08-19 11:14:36
阅读次数:
150
Given a number n, find the total number of numbers from 0 to 2^n - 1 which do not have consecutive 1s in their binary representation. Solution. This p ...
分类:
其他好文 时间:
2017-08-19 11:07:00
阅读次数:
117
递归解法: 从先序遍历中得到树的根节点,从中序遍历中得到左右数的组成节点。 更好理解的解法: ...
分类:
其他好文 时间:
2017-08-19 11:05:37
阅读次数:
130
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 dept ...
分类:
其他好文 时间:
2017-08-18 23:45:49
阅读次数:
171
题目链接:http://codeforces.com/problemset/problem/792/D 画出树,找找规律,画图就好了。不算麻烦。 往下走的时候特判是不是叶子,往上走的时候特判是不是根。其余时候按照规律转移就是。 感觉可以推广到建树上,可以缩小常数是极好的。 ...
分类:
其他好文 时间:
2017-08-18 21:26:49
阅读次数:
199
Count Number of Binary Tree Possible given Preorder Sequence. For example, given preorder sequence of {10, 11, 9, 12, 13, 14}, the total possible numb ...
分类:
其他好文 时间:
2017-08-18 15:24:19
阅读次数:
163