Dot Tool BinarySearchTree Java -
i seek write dot file next add-on of integers binarysearchtree, no file generated project file upon execution.
public void testadd() { binarysearchtree<integer> bst = new binarysearchtree<integer>(); bst.add(1); bst.add(2); bst.add(3); bst.add(4); bst.add(5); bst.writedot("bst.dot"); } public static printstream out; public void writetofile( ) throws ioexception{ out = new printstream(new fileoutputstream("bst.dot")); writetofile(root); out.close(); } public void writetofile(binarytreenode t) throws ioexception { if (t != null) { system.setout(out); system.out.println(t.info); writetofile(t.left); writetofile(t.right); } }
java
No comments:
Post a Comment