Problem Description
Long long ago, there was a gunner whose name is Jack. He likes to go hunting very much. One day he go to the grove. There are n birds and n trees. The i-th bird stands on the to...
分类:
其他好文 时间:
2015-06-09 22:04:06
阅读次数:
140
今天做了一道leetcode题,刚开始是暴力破解,发现special judge, very large tree 过不去,然后一顿想,一顿查,发现可以运用complete binary tree 的性质,然后用的python编写,发现还是过不去,(这个版本是运用左右子数的高度去查找,如果相等那么可...
分类:
其他好文 时间:
2015-06-09 21:45:50
阅读次数:
113
题目链接:http://acm.swust.edu.cn/problem/856/Time limit(ms): 1000 Memory limit(kb): 10000There are N trees in a forest. At first, each tree contain...
分类:
其他好文 时间:
2015-06-09 21:38:57
阅读次数:
121
题目链接 题目要求: 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 ...
分类:
其他好文 时间:
2015-06-09 21:20:57
阅读次数:
76
二叉排序树(Binary Sort Tree),又称二叉查找树。它或者是一颗空树,或者是具有下列性质的二叉树。
若它的左子树不空,则左子树上所有节点的值都小于它的根节点的值;
若它的右子树不空,则右子树上所有节点的值都大于它的根节点的值;
它的左、右子树也分别为二叉排序树。
上面就是一棵二叉排序树,当我们对它进行中序遍历时,就可以得到一个有序的序列{35,37,47,51,58,62,73,88...
分类:
编程语言 时间:
2015-06-09 20:08:34
阅读次数:
266
需要检查一下这个文件是否 shell 脚本, 如果是shell脚本, 才可以使用 “sh ***.run”的形式执行。
如果本身是一个可执行的命令程序, 不需要使用 sh, 直接加上执行权限, 执行这个应用程序就可以 (类似 windows下的 。exe文件 )
如果不是shell脚本
1. file 文件名
可以查看文件类型;
2. 或者: more 文件名
查看文件内容是否可读文...
分类:
系统相关 时间:
2015-06-09 17:32:25
阅读次数:
677
分析:直接求出凸包,再算边长即可。另外只有一个点时为0.00单独处理,两个点直接为距离也单独处理。
#include
#include
#include
using namespace std;
struct Point
{
Point(){}
Point(double _x,double _y):x(_x),y(_y){}
Point operator-(const Point& a)...
分类:
其他好文 时间:
2015-06-09 17:12:49
阅读次数:
114
1 #ifndef __TREE_H 2 #define __TREE_H 3 #include 4 5 template class TreeNode { 6 private: 7 T _data; 8 TreeNode* _left;...
分类:
其他好文 时间:
2015-06-09 16:38:54
阅读次数:
113
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-06-09 11:34:41
阅读次数:
102
Given acompletebinary tree, count the number of nodes.Definition of a complete binary tree fromWikipedia:In a complete binary tree every level, except...
分类:
其他好文 时间:
2015-06-09 09:46:13
阅读次数:
105