- 博客(6)
- 问答 (2)
- 收藏
- 关注
原创 SPFA模板
spfa的关键: 只有上一次经过松弛操作的点,才可能使其邻接点的距离值产生改变 用一个队列来存放被成功松弛的顶点。初始时,源点s入队。当队列不为空时,取出队首顶点,对它的邻接点进行松弛。如果某个邻接点松弛成功,且该邻接点不在队列中,则将其入队。经过有限次的松弛操作后,队列将为空,算法结束。 #include #include #include #define Max
2015-02-27 16:38:01 525
原创 矩阵相关
#include //矩阵乘法#include using namespace std;typedef vector vec;typedef vertor mat;int m = 100;// a*bmat multi(mat a,mat b){ mat c (a.size(),vec(b[0].size())); for(int i=0 ;i<a.siz
2015-02-15 10:48:36 569
原创 sort函数cmp函数集合
一、对int类型数组排序 int num[100]; Sample: int cmp ( const void *a , const void *b ) { return *(int *)a - *(int *)b; } qsort(num,100,sizeof(num[0]),cmp); 二、对char类型数组排序(同int类型) char wor
2014-04-03 18:18:18 1051
原创 并查集优化
按秩合并矮树合并到高树void Union(int a, int b) { if(tree[a].weight == tree[b].weight) { //树高一样 tree[b].parent = a; tree[a].weight += 1; } else if (tree[a].w
2014-04-03 18:00:50 1042
空空如也
sql联合查询,结果部分出错
2016-09-08
osx android studio虚拟机启动黑屏
2016-03-22
TA创建的收藏夹 TA关注的收藏夹
TA关注的人