Write a method in the Tree class to dump (Parse InOrder) the contents to a textfile "inorder.txt".
private void inorderHelper( TreeNode node ) {
if ( node == null )
return;
//traverse left subtree
inorderHelper( node.leftNode );
//output node data
System.out.print( node.data + " " );
//traverse right subtree
inorderHelper( node.rightNode );
}//inorderHelper()
// begin postorder traversal
public void postorderTraversal() {
postorderHelper( root );
}
2006-12-19
15:56:45
·
1 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design