Thursday, March 9, 2017

DFS Algorithm Implementation

1
2
3
4
5
6
7
8
9
10
void dfs(int at){
    if(vis[at]) return ;
    else{
        vis[at]=1;
        for(int i=0; i<vt[at].size(); i++){
            int v=vt[at][i];
            dfs(v);
        }
    }
}

No comments:

Post a Comment