Hi,
I have problem with following method that we used for BinryTree Traversal. The follow method is good so far.
But,
Now I have to change this method in such a way that it will return String(which will contains preorder expression).
Any Idea. Thank you in Advance.
I have problem with following method that we used for BinryTree Traversal. The follow method is good so far.
Code:
public void preorderHelper(MyBinaryTreeNode rt){
if(rt==null)
return;
System.out.print(" "+rt.data);
preorderHelper(rt.left);
preorderHelper(rt.right);
}
Now I have to change this method in such a way that it will return String(which will contains preorder expression).
Code:
public String preorderHelper(MyBinaryTreeNode rt){
/*
??????????
*/
}
Any Idea. Thank you in Advance.