Hi guys I have question and need help.Maybe it's offtopic but I've already posted it on Code Review but noones answers. I've written this using pseudocode, and I am stuck.I should examine if number of Vertices in one conected component is even. My idea is to implement DFS and to put one counter and then to check whether counter%2==0 is or not. My problem is I don't know where to put counter. Let's say DFS: is main method.
G = (V,E) V- vertices, E-edges s-start point(vertex)
DFS(G,s):
boolean result <-- false
Discovered[v] <-- false for all Vertices V(v)
DFS1(G,s)
if (DFS1(G,u) % 2==0)
result <-- true
DFS1(G,u):
Discovered[u] <-- true
// counter ++ But where I should initialize it??
foreach Edge (v,u) incident to u
if !Discovered[v]
DFS1(G,v)`