Algo(G,L)
countDist=0
for i=0 to L.lenght-2
Dijkstra(G,L[i])
countDist+=d[L[i+1]] //d = vector of the distances
return countDist
复杂度:
L最多| V | elements => O(| V |)(循环迭代次数)
Dijkstra with minHeap => O(| E |登录| V |) 总计:O(| V || E | log | V |)
我的问题是:这是最有效的解决方案吗?