临近期末,算法老师留下一个斯坦福公开课的课堂思考题,说本题做出来的同学在期末成绩上+5分,有这等好机会能争取一下还是得争取一下的。本题的思路并不难,主要是基于小顶堆对Dijkstra进行稍做改进。
该思考题如下:
In lecture we define the length of a path to be the sum of the lengths of its edges. Define the bottleneck of a path to be the maximum length of one of its edges. A mininum-bottleneck path between two vertices s and t is a path with bottleneck no larger than that of any other s−t path. Show how to modify Dijkstra’s algorithm to compute a minimum-bottleneck path between two given vertices. The running time should be 𝑂(𝑚log𝑛), as in lecture.
1 Dijkstra
在进行改进Dijkstra之前,我先进行回顾+总结一下Dijkstra。详细请看:
2. 用Dijkstra处理bottleneck与mininum bottleneck问题
下面结合小顶堆及Dijkstra的思想进行处理mininum bottleneck问题,详细请看: