最短路
*红小豆
这个作者很懒,什么都没留下…
展开
-
最短路:Floyd弗洛伊德算法--Dijkstra迪杰斯特拉算法--bellman-ford -- spfa算法
Floyd(Floyd-Warshall) 弗洛伊德算法: 又称为插点法,是一种利用动态规划的思想寻找给定的加权图中多源点之间最短路径的算法,与Dijkstra算法类似。 适用于多源最短路径,是一种动态规划的算法,稠密图效果更佳,边权可正可负。 优点:容易理解,可以算出任意两个节点之间的最短距离,代码编写简单。 缺点:时间复杂度比较高(O(n3))...原创 2019-03-31 15:45:31 · 281 阅读 · 0 评论 -
POJ - 3268
One cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirectional (one-way ro...原创 2019-04-10 20:52:52 · 115 阅读 · 0 评论 -
HDU - 1385
These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transpor...原创 2019-04-10 20:59:50 · 194 阅读 · 0 评论