Untitled
unknown
c_cpp
4 years ago
414 B
13
Indexable
finUnreachableNode(int node)
{
bool* visited = new bool[node];
for (int i = 0; i < node; i++)
visited[i] = false;
DFSUtil(node, visited);
// this function is used to use dfs and search for adjancey list representation
int count = 0;
for (int i = 0; i < node; i++) {
if (visited[i] == false)
count++;
}
return count;
}Editor is loading...