8000 Fix wrong variable names in connected components · cp-algorithms/cp-algorithms@dc9f2d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc9f2d1

Browse files
nhuhoang0701adamant-pwn
authored andcommitted
Fix wrong variable names in connected components
Variable in the loop in the code for search connected components is supposed to be v, not i
1 parent 1260771 commit dc9f2d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/graph/search-for-connected-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ void dfs(int v) {
3636
void find_comps() {
3737
fill(used.begin(), used.end(), 0);
3838
for (int v = 0; v < n; ++v) {
39-
if (!used[i]) {
39+
if (!used[v]) {
4040
comp.clear();
41-
dfs(i);
41+
dfs(v);
4242
cout << "Component:" ;
4343
for (int u : comp)
4444
cout << ' ' << u;

0 commit comments

Comments
 (0)
0