12 2017 档案

摘要:今天介绍一种计算单源最短路径的算法Bellman-Ford算法,对于图G=(V,E)来说,该算法的时间复杂度为O(VE),其中V是顶点数,E是边数。Bellman-Ford算法适用于任何有向图,并能报告图中存在负环路(边的权重之和为负数的环路,这使得图中所有经过该环路的路径的长度都可以通过反复行走该 阅读全文
posted @ 2017-12-26 16:28 alm 阅读(337) 评论(0) 推荐(0) 编辑
摘要:1 //program 2-1 2 #include 3 #include 4 const int N=1000005; 5 using namespace std; 6 7 double w[N]; //古董的重量数组 8 int main() 9 { 10 double c; 11 int n; 12 cout>c>>n; 14 cou... 阅读全文
posted @ 2017-12-26 09:04 alm 阅读(914) 评论(0) 推荐(0) 编辑
摘要:1 // 2 // Created by alim on 2017/12/23. 3 // 4 5 #include 6 #include //求绝对值函数需要引入该头文件 7 using namespace std; 8 const int M=1000+5; 9 double c[M][M],w[M][M],p[M],q[M]; 10 int s[... 阅读全文
posted @ 2017-12-26 08:10 alm 阅读(403) 评论(0) 推荐(0) 编辑
摘要:1 // 2 // Created by alim on 2017/12/23. 3 // 4 5 6 #include 7 #include 8 #include 9 using namespace std; 10 11 #define M 100 12 13 char sa[1000]; 14 char sb[1000]; 15 ... 阅读全文
posted @ 2017-12-24 11:16 alm 阅读(171) 评论(0) 推荐(0) 编辑
摘要:大整数相乘 分治思想解决大整数相乘 1.初始化 将a、b倒序存储在数组a.s[]、b.s[]中 a.L 是长度 a.c是阶数 2.分解 将一个n位的数分解成两个n/2位的数并存储,记录它的长度和阶数 ah 高位 al 低位 bh 高位 bl 低位 3.求解子问题 ah*bh ah*bl al*bh 阅读全文
posted @ 2017-12-22 08:52 alm 阅读(647) 评论(0) 推荐(1) 编辑
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 #define MAX 99999 9 using namespace std; 10 11 struct point{ //点结构 12 double x,y; 13 }; 1... 阅读全文
posted @ 2017-12-21 11:53 alm 阅读(377) 评论(0) 推荐(0) 编辑
摘要:1 // 2 // Created by alim on 2017/12/18. 3 // 4 5 #include "dazs.h" 6 #include 7 #include 8 #include 9 #define NUM_LEN 50//数字的最大长度 10 11 int main() 12 { 13 int i, n, temp = 0, p, k; ... 阅读全文
posted @ 2017-12-21 11:48 alm 阅读(354) 评论(0) 推荐(0) 编辑
摘要:1 // 2 // Created by alim on 2017/12/21. 3 // 4 5 #include "iostream" 6 #include "algorithm" 7 8 using namespace std; 9 const int INF = 0x3fffffff;//表示无穷大 10 const int N = 100;//节点最大值 11 b... 阅读全文
posted @ 2017-12-21 11:46 alm 阅读(335) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示