DFS_Graph

Run Settings
LanguageC++
Language Version
Run Command
#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; }
Editor Settings
Theme
Key bindings
Full width
Lines