# Binary tree

Dmitri Makovetskiy
Ranch Hand
Posts: 128

the algorithm above should give me a binary tree. i have one question. what current.info represent? what number?

David Newton
Author
Rancher
Posts: 12617
...

Is this code that you wrote yourself?

Dmitri Makovetskiy
Ranch Hand
Posts: 128
David Newton wrote:...

Is this code that you wrote yourself?

NO, NEWTON, it is my teachers code. i understand that. but i dont understand the line which i marked

David Newton
Author
Rancher
Posts: 12617

So, follow the code: I'm still not convinced you ever work out anything on paper--this is a *critically* important skill.

2) What does the Node constructor do?

That's all it takes: you only had to look at a few lines of code to determine the answer.

Dmitri Makovetskiy
Ranch Hand
Posts: 128

So, follow the code: I'm still not convinced you ever work out anything on paper--this is a *critically* important skill.

2) What does the Node constructor do?

That's all it takes: you only had to look at a few lines of code to determine the answer.

Newton , i scanned the whole thing. i know where the info comes from

but what value does the current.info has got?

David Newton
Author
Rancher
Posts: 12617
The same value it was constructed with.

Campbell Ritchie
Sheriff
Posts: 50656
83
David Newton wrote: . . . I'm still not convinced you ever work out anything on paper--this is a *critically* important skill. . . .
Agree with David N.

You need to imagine you have added 2 3 1 in that order to a tree, and draw a diagram of that tree after adding each of those values.