Tony Docherty wrote:Forget the code for a moment and get a pen and paper and write down your native language in detail how you would do it if you were constructing the tree from values someone else was passing to you..
Once you have a detailed written description then you can turn that into code.
I am not constructing a tree by passing a value onto the method, the value is created by the getfuction method and then passed into the node where it is currently null. I have been thinking about this code for a while and i still don't quite understand why it is not working.
The code method does executes the else statement, that means that i is also creating a new child node for me. But, when i output the result it outputs the original tree(as in the original Nodes arguement).
Note: I am trying to add child nodes dynamically