
最短路
文章平均质量分 88
阿_波_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
SPFA算法详解及模板
写在前面我们现在熟悉的Dijkstra算法基本思路是:每次寻找已知节点到达未知节点距离最短的一个节点,那么这个位置节点的最短距离我们就知道了,这个未知节点变为已知节点,再去更新未知节点的距离......那么这样我们就需要寻找N-1次就可以找到最终的答案,因为每次我们都会得到一个点的最短距离,当然,Dijkstra算法因为每次都要去找距离已知点中距离最短的点,那么我们就可以使用优先队列来进行优化,这...原创 2018-05-19 16:32:09 · 2255 阅读 · 1 评论 -
Dijkstra算法+链式前向星+优先队列优化
写在前面 如果采用O(n^2)的Dijkstra算法的话,可能会遇到图中节点过多,建立二维map数组的话,数组过大开不了,并且时间复杂度较高,所以这里说一下采用链式前向星以及优先队列优化的Dijkstra算法 链式前向星 https://www.cnblogs.com/ahalei/p/3651334.html 《啊哈!算法》啊哈磊著 写的很好的算法书,描述内容很简单很生动! ...原创 2018-11-25 20:53:43 · 2432 阅读 · 1 评论 -
最短路_1018 Public Bike Management (30 分)
1018 Public Bike Management (30 分) There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...原创 2018-12-04 19:26:52 · 659 阅读 · 0 评论 -
Dijkstra_1072 Gas Station (30 分)
1072 Gas Station (30 分) A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must g...原创 2018-12-26 21:40:25 · 416 阅读 · 0 评论