印象笔记同步分享:Machine Learning—Mixtures of Gaussians and the EM algorithm...
分类:
其他好文 时间:
2014-08-28 22:42:46
阅读次数:
257
【题意】
逆波兰表达式,又叫后缀表达式。
例如:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
【思路】
用一个栈存储操作数,遇到操作数直接压入栈内,遇到操作符就把栈顶的两个操作数拿出来运算一下,然后把运算结果放入栈内。
【Jav...
分类:
其他好文 时间:
2014-08-28 21:13:36
阅读次数:
247
迭代器中copy()andinsertiterators//inserts.cppcopy()andinsertiterators
#include<iostream>
#include<string>
#include<iterator>
#include<vector>
#include<algorithm>
usingnamespacestd;
voidoutput(conststring&s)
{
cout<<s..
分类:
其他好文 时间:
2014-08-28 18:18:06
阅读次数:
199
这种洗牌方式的算法:
1:初始化一个长度为54的数组,和54张牌。
2:从i=1开始到54,每次从剩余的牌堆中随机抽一张牌放到数组的i下标下。
这样我们可以用一个数组做也可以用两个数组做。
就和经典的选择排序一样。
#include
#include
#include
#include
#include
#include
#define POKER_NUM 54
int poker[54...
分类:
编程语言 时间:
2014-08-28 13:23:09
阅读次数:
393
FinonacciT(N) = T(N-1) + T(N-2);>= 2T(N-2) = O(2^(N/2))Memorized Dp algorithm//1,1,2,3,5,8.....Memo = {}fib(n): if n in memo, return memo{n} if n<...
分类:
其他好文 时间:
2014-08-28 04:16:28
阅读次数:
183
题目:hdoj 3820 Golden Eggs
题意:给出一个矩阵,然后当前有三种选择,放一个金蛋,放一个银蛋,或者不放,然后给出每个格子放金蛋或者银蛋的得分,如果金蛋相邻的话每个得分要减掉cost1,银蛋相邻的话每个减去cost2得分,问最大得分多少?
分析:做这个题目推荐先做hdoj 1659 ,3657点击打开链接 ,这个题目相当于前两个的融合在加点变化。
首先我们发...
分类:
其他好文 时间:
2014-08-27 20:37:18
阅读次数:
264
题目链接:http://poj.org/problem?id=2992
题目大意:就是叫你求组合数C(n,m)的因子的个数。
思路:求解这题需要用到以下几个定理
1、对任意的n,可以这么表示 n=p1^e1*p2^e2*p3*e3*......pn^en
。(p1,p2,p3......pn都为素数)
2、对任意的n的因子数为:(1+e1)*(1+e2)*(1+...
分类:
其他好文 时间:
2014-08-27 20:33:58
阅读次数:
206
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3371题目不难 稍微注意一下 要把已经建好的城市之间的花费定义为0,在用普通Prim算法就可以了;我没有用克鲁斯卡尔算法(Kruskal's algorithm),因为这题数据比较大,而且要处理大量的数据...
分类:
其他好文 时间:
2014-08-27 20:30:38
阅读次数:
221
1 Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear run...
分类:
其他好文 时间:
2014-08-27 18:38:28
阅读次数:
174
Given a sorted array of integers, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in t...
分类:
其他好文 时间:
2014-08-27 13:05:17
阅读次数:
226