@@ -0,0 +1,983 @@
+Class Main %7B%0Apublic void dfs() %7B%0A%09%09// DFS using Stack data structure%0A%09%09Stack stack = new Stack();%0A%09%09stack.push(this.rootNode);%0A%09%09rootNode.visited=true;%0A%09%09printNode(rootNode);%0A%09%09while(!stack.isEmpty()) %7B%0A%09%09%09Node node = (Node)s.peek();%0A%09%09%09Node child = getUnvisitedChildNode(n);%0A%09%09%09if(child != null) %7B%0A%09%09%09%09child.visited = true;%0A%09%09%09%09printNode(child);%0A%09%09%09%09s.push(child);%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09s.pop();%0A%09%09%09%7D%0A%09%09%7D%0A%09%09// Clear visited property of nodes%0A%09%09clearNodes();%0A%09%7D%0A%7D%0A%0A%09public void bfs()%0A%09%7B%0A%09%09// BFS using Queue data structure%0A%09%09Queue queue = new LinkedList();%0A%09%09queue.add(this.rootNode);%0A%09%09printNode(this.rootNode);%0A%09%09rootNode.visited = true;%0A%09%09while(!queue.isEmpty()) %7B%0A%09%09%09Node node = (Node)queue.remove();%0A%09%09%09Node child=null;%0A%09%09%09while((child=getUnvisitedChildNode(node))!=null) %7B%0A%09%09%09%09child.visited=true;%0A%09%09%09%09printNode(child);%0A%09%09%09%09queue.add(child);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09// Clear visited property of nodes%0A%09%09clearNodes();%0A%09%7D%0A%0AClass Node %7B%0A   Char data;%0A   Public Node(char c) %7B%0A      this.data=c;%0A%7D%0A

Create BFSDFS.java