###### Using C/C++/Java for implementing the Depth First Search Algorithm

**Code:**

import java.io.*; class DepthFirst { static void dfs1(int a[ ][ ], int m[ ], int i, int n) { int j; System.out.println(“\t” + (i+1)); m[i] = 1; for(j=0; j<n; j++) if(a[i][j]==1 && m[j]==0) dfs1(a,m,j,n); } public static void main(String args[]) throws IOException { int n, i, j; System.out.println(“How many vertices do you want ? : “); BufferedReader br= new