/* * Tree Traversal In order Traversal. */ public void inOrder(Nodes localNode) { if (localNode != null) { /* * Visit the left Node */ inOrder(localNode.leftChild); /* * Visit the current Node */ localNode.display(); /* * Visit the right node */ inOrder(localNode.rightChild); } }
/* * PreOrder Traversal */ public void preOrder(Nodes localNode) { if (localNode != null) { /* * Visit the Current Node */ localNode.display(); /* * Visit the left Child */ preOrder(localNode.leftChild); /* * Visit the right child */ preOrder(localNode.rightChild); } }