Once an algorithm is given for a problem and
decided to be correct, an important step is to determine how much in the way of resources,such as time or space, the algorithm will require.
...
分类:
其他好文 时间:
2014-06-05 02:14:29
阅读次数:
306
1.php -v 查看版本号
2.php -h 查看帮助
3.php -m 查看安装的模块
4.php -i 查看php信息(查看php.ini非常方便)
5.php --ini 显示配置文件名字
6.php -f 执行php文件...
分类:
Web程序 时间:
2014-06-04 23:49:13
阅读次数:
356
一条消息由A-Z的字母组成,将该消息按照上面的对应关系进行编码。给定一条已经经过编码的数字消息,求有多少种方式来对它进行解码。...
分类:
其他好文 时间:
2014-06-04 23:41:15
阅读次数:
442
题意:求一条线上最多几个点
思路:枚举一个点,然后求出过这个点的直线的斜率来求最大值
#include
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 710;
const int INF = 1e7;
int arr[MAXN][2],n;
float brr[...
分类:
其他好文 时间:
2014-06-04 22:29:53
阅读次数:
333
DP求解。对Blocks的先按照X降级,再按照Y降级排序,可以转化为最长公共子序列问题,即求子序列权值之和最大。
#include
#include
#include
using namespace std;
#define MAX_SIZE 300
struct Block{
int x;
int y;
int height;
};
int nums...
分类:
其他好文 时间:
2014-06-03 04:39:44
阅读次数:
223
An iterative way of writing merge sort:
#include
using namespace std;
void merge(int A[], int l, int r, int e, int B[]) {
int i = l, j = r, k = l;
while (i<r && j A[j]) B[k++] =...
分类:
其他好文 时间:
2014-06-03 02:33:24
阅读次数:
215
题目:
给定一个字符串,返回该串没有重复字符的最长子串。
分析:
1)子串:子串要求是连续的。
2)无重复,出现重复就断了,必须从新的位置开始。而新的位置就是重复字符第一次出现位置的下一个位置。
3)整个串可能没有一处重复。
那么,为了找出当前访问的字符是否出现过,要怎么做呢?当然是hash,O(1)的时间,而且既然是字符, 定义个255的hash table 就可以了,has...
分类:
其他好文 时间:
2014-06-01 10:48:31
阅读次数:
206
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space....
分类:
其他好文 时间:
2014-06-01 10:41:23
阅读次数:
242