Quick actions

cmd+k|ctrl+k

Navigation

Languages

DFS_Graph

Snippet info

Language

Cpp

Visibility

public

Author

shin

Created

2022-03-23T03:14:19.022451Z

Updated

2022-03-23T03:38:44.103218Z

#include <iostream>
using namespace std;
#define MAX 100
int vis[MAX];
int b[MAX][MAX];
int n = 0;
void dfs(int t){
    vis[t]=1;
    for(int i = 0; i < n; i++){
        if(b[t][i]&&vis[i]==0){
            dfs(i);
        }
        
    }
}

int main() {
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> b[i][j];
        }
    }
    
    cout << "Hello World!";
    return 0;
}
INFO