码迷,mamicode.com
首页 >  
搜索关键字:greedy    ( 311个结果
贪心问题的基本性质
首先确定一个前提 该问题是或可能满足 最优子结构,greedy选择性 最优子结构是说。。子结构一定能对全局最优解作贡献(?) greedy选择性应该是说。。如果当前我们不贪心地选本来看上去或者就是正确的决策an 那么我们得到结果s,只要证明交换an得到s`比不交换更好,即可证明这个问题。。 所以说贪 ...
分类:其他好文   时间:2016-12-23 22:00:23    阅读次数:173
Leetcode: Rearrange String k Distance Apart
Analysis: Solution 1: The greedy algorithm is that in each step, select the char with highest remaining count if possible (if it is not in the waiting ...
分类:其他好文   时间:2016-12-16 11:58:23    阅读次数:263
Leetcode: Assign Cookies
Solution 1: Greedy, Time:O(nlogn) Just assign the cookies starting from the child with less greediness to maximize the number of happy children . Solu ...
分类:其他好文   时间:2016-12-13 08:08:01    阅读次数:171
Leetcode: Minimum Number of Arrows to Burst Balloons
我的Greedy+Heap做法: Array按start moment升序sort,Heap里按end moment升序sort,一旦到Heap里结束时间最早的气球的end,就要扔arrow,这时在heap里的气球都会被引爆 改进:因为一旦气球爆了的话,Heap里面的元素要全部清空,不需要知道Hea ...
分类:其他好文   时间:2016-12-08 07:38:35    阅读次数:218
Leetcode: Split Array Largest Sum
Binary Search Solution(+greedy) refer to https://discuss.leetcode.com/topic/61324/clear-explanation-8ms-binary-search-java 我的DP解法,skip了几个MLE的big case之 ...
分类:其他好文   时间:2016-12-05 07:48:38    阅读次数:337
Leetcode: Is Subsequence
Basic Solution: DP, O(mn) time, O(m) space, m is the size of s, n is the size of t Greedy Solution: O(n) time, O(1) space Follow Up: The best solution ...
分类:其他好文   时间:2016-11-30 13:45:09    阅读次数:144
an optimal solution to the problem
http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Greedy/greedyIntro.htm Greedy Introduction Greedy algorithms are simple and straightfor ...
分类:其他好文   时间:2016-11-06 07:52:33    阅读次数:247
LeetCode "Is Subsequence"
There are 3 possible approaches: DP, divide&conquer and greedy. And apparently, DP has O(n^2) complexity, DivideConquer can only be worse. Greedy can ...
分类:其他好文   时间:2016-10-24 07:42:05    阅读次数:234
Greedy Gift Givers
题解: 模拟。 照着他的过程(看看提示)模拟下去就行了。 { ID:h1956701 LANG:PASCAL PROB:gift1 } var n,i,k,j,m:longint; s:ansistring; a:array[0..11]of ansistring; b,c:array[0..11] ...
分类:其他好文   时间:2016-10-09 09:03:05    阅读次数:111
Dynamic Programming
We began our study of algorithmic techniques with greedy algorithms, which in some sense form the most natural approach to algorithm design. Faced wit ...
分类:其他好文   时间:2016-10-01 21:53:20    阅读次数:246
311条   上一页 1 ... 11 12 13 14 15 ... 32 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!