jeudi 4 janvier 2018

why runtime error in this function c++ depth first search?

why this function get runtime error what is the wrong with it?

void dfs(int node){
  visited[node]=true;
  for(int i=1;i<=arr[node].size();i++){
   int child=arr[node][i];
   if(!visited[child]){
    dfs(child);
   }
  }
}

Aucun commentaire:

Enregistrer un commentaire