print allvalues of nodes in binary tree java code example
Example: print all nodes in binary tree java
public class Node<E>{
private Node left;
private Node right;
private E elem;
public void printNodes(){
if(left!=null){
left.printNodes();
}
System.out.println(elem);
if(right!=null){
right.printNodes();
}
}
}