@@ -0,0 +1,1052 @@
+import java.util.*;%0A%0Apublic class depthFirstSearch%0A%7B%0A    int Vertices;%0A%0A    LinkedList%3CInteger%3E adjList%5B%5D;%0A%0A    depthFirstSearch(int vertices)%0A    %7B%0A        Vertices = vertices;%0A        adjList = new LinkedList%5Bvertices%5D;%0A        for (int i=0; i%3Cvertices; ++i)%0A        %7B%0A            adjList%5Bi%5D = new LinkedList();%0A        %7D%0A    %7D%0A    void addEdges(int vertices, int u)%0A    %7B%0A        adjList%5Bvertices%5D.add(u);%0A    %7D%0A%0A    void DFTraversal(int vertices,int visited%5B%5D)%0A    %7B%0A        visited%5Bvertices%5D = 1;%0A        System.out.print(vertices + %22 %22);%0A        Iterator%3CInteger%3E i = adjList%5Bvertices%5D.listIterator();%0A        while (i.hasNext())%0A        %7B%0A            int n = i.next();%0A            if (visited%5Bn%5D==0)%0A                DFTraversal(n, visited);%0A        %7D%0A    %7D%0A%0A    void DFSearch(int vertices)%0A    %7B%0A%0A        int visited%5B%5D = new int%5BVertices%5D;%0A%0A        DFTraversal(vertices, visited);%0A        for (int i=1;i%3CVertices;i++)%0A        %7B%0A            if(visited%5Bi%5D==0)%0A            %7B%0A                DFTraversal(i, visited);%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Create deptFirstSearch.java