-
-
Save wohhie/45018e4bea98bde4b0f07db05d83ef86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] visited = new int[8]; | |
public void traverse(int[][] G, int u){ | |
if (visited[u] == 0){ | |
System.out.print(u + " "); | |
visited[u] = 1; | |
for (int v = 1; v <G.length; v++){ | |
if (G[u][v] == 1 && visited[v] == 0){ | |
traverse(G, v); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment