Skip to content

Commit

Permalink
remove PQ comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lrvideckis committed Oct 23, 2024
1 parent 0d960a1 commit d81bf6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/graph/TopoSort.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#pragma once

vi topoSort(const vector<vi>& gr) {
vi indeg(sz(gr)), q; // use priority_queue for lexic. largest ans.
vi indeg(sz(gr)), q;
for (auto& li : gr) for (int x : li) indeg[x]++;
rep(i,0,sz(gr)) if (indeg[i] == 0) q.push_back(i);
int j = 0;
while (j < sz(q)) {
int i = q[j++]; // top() for priority queue
int i = q[j++];
for (int x : gr[i])
if (--indeg[x] == 0) q.push_back(x);
}
Expand Down

0 comments on commit d81bf6e

Please sign in to comment.