diff options
| author | kittobi1992 <kittobi1992@users.noreply.github.com> | 2014-11-24 15:15:32 +0100 |
|---|---|---|
| committer | kittobi1992 <kittobi1992@users.noreply.github.com> | 2014-11-24 15:15:32 +0100 |
| commit | fe77a131a5e6542662a3b9f61a0d787c5b15e844 (patch) | |
| tree | e834e7d0c1bfa6c48e054771e425348ab431a4b8 /graph | |
| parent | 8be73d5d2f24721795991badfb3cfe5eb551beb8 (diff) | |
fix bugs
Diffstat (limited to 'graph')
| -rw-r--r-- | graph/dijkstra.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/graph/dijkstra.cpp b/graph/dijkstra.cpp index e7ec0c3..92df955 100644 --- a/graph/dijkstra.cpp +++ b/graph/dijkstra.cpp @@ -5,16 +5,16 @@ dist[0] = 0; pq.push(ii(0, 0)); while (!pq.empty()) { - di front = pq.top(); pq.pop(); + ii front = pq.top(); pq.pop(); int curNode = front.second, curDist = front.first; if (curDist > dist[curNode]) continue; - for (i = 0; i < (int)adjlist[curNode].size(); i++) { + for (int i = 0; i < (int)adjlist[curNode].size(); i++) { int nextNode = adjlist[curNode][i].first, nextDist = curDist + adjlist[curNode][i].second; if (nextDist < dist[nextNode]) { dist[nextNode] = nextDist; pq.push(ii(nextDist, nextNode)); } } -}
\ No newline at end of file +} |
