码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
String to Integer (atoi)
[leetcode]String to Integer (atoi)...
分类:其他好文   时间:2014-09-12 10:15:01    阅读次数:150
【LeetCode】Clone Graph 解题报告
【题目】 Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separa...
分类:其他好文   时间:2014-09-11 22:29:02    阅读次数:223
uva 10870 Recurrences
题目链接:链接。。。。 思路:就是构造一个矩阵  f[n]=a1*f[n-1]+a2*f[n-2]+...+ad*f[n-d];     由于n太大,不能直接递推,需要用矩阵快速幂来解决,时间复杂度为O(d^3logn)     举例,d=5的矩阵关系式为:                 |a1 a2 a3 a4 a5|                 | f[n]     |    ...
分类:其他好文   时间:2014-09-11 22:25:51    阅读次数:217
【DP】 HDU 2660 Accepted Necklace 限制背包
给出n个物品 最多能拿k个 选取的物品的总重量不能超过w 因为每个物品只有一个 转移顺序为         for(int i=0; i             for(int j=w; j>=b[i]; j--)                 for(int l=1; l 保证了一个物品只放进一次 #include #include #include #include ...
分类:其他好文   时间:2014-09-11 21:02:12    阅读次数:114
POJ 2492 A Bug's Life
题目来源:http://poj.org/problem?id=2492 A Bug's Life Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 28494   Accepted: 9286 Description Background  ...
分类:其他好文   时间:2014-09-11 19:22:22    阅读次数:154
kruskal算法
克鲁斯卡尔算法(Kruskal's algorithm)是两个经典的最小生成树算法的较为简单理解的一个。这里面充分体现了贪心算法的精髓。大致的流程可以用一个图来表示。这里的图的选择借用了Wikipedia上的那个。非常清晰且直观。 首先第一步,我们有一张图,有若干点和边。 第一步我们要做的事情就是将所有的边的长度排序,用排序的结果作为我们选择边的依据。这里再次体现了贪心算法的思想。资源...
分类:其他好文   时间:2014-09-11 15:23:52    阅读次数:197
Word Ladder II
[leetcode]Word Ladder II...
分类:其他好文   时间:2014-09-11 13:56:42    阅读次数:214
poj3122 Pie
题目链接:http://poj.org/problem?id=3122 题目大意:有N个蛋糕,要分给F+1个人,要求面积相等且每个人得到的是一整块而不是拼接而成的。 思路:每个人分到的面积范围为[0,s总/(F+1)],所以就从最大的那一个开始分,并计算出按此面积能分出多少块。。。。 特别注意这题,开始WA啦很多次就是因为pi的取值,pi取3.1415926精度还不行,要更高才行。。。。还坑...
分类:其他好文   时间:2014-09-11 12:36:11    阅读次数:208
TIFF6 Packbit algorithm
“Packbits” from ISO 12369参考TIFF 6.0 Specification,点击TIFF, Version 6.0;@Section 9: PackBits Compression> This section describes TIFF compression type 3...
分类:其他好文   时间:2014-09-10 21:01:51    阅读次数:280
算法导论-求(Fibonacci)斐波那契数列算法对比
目录 1、斐波那契数列(Fibonacci)介绍 2、朴素递归算法(Naive recursive algorithm) 3、朴素递归平方算法(Naive recursive squaring...
分类:其他好文   时间:2014-09-10 20:51:21    阅读次数:602
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!