aspose file tools*
The moose likes Java in General and the fly likes Binary tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Binary tree" Watch "Binary tree" New topic
Author

Binary tree

Dmitri Makovetskiy
Ranch Hand

Joined: Jun 21, 2010
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

Joined: Sep 29, 2008
Posts: 12617

...

Is this code that you wrote yourself?
Dmitri Makovetskiy
Ranch Hand

Joined: Jun 21, 2010
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

Joined: Sep 29, 2008
Posts: 12617

Please KeepItDown.

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

1) What does BTree.add(int) do?
2) What does the Node constructor do?
3) Question answered, correct?

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

Joined: Jun 21, 2010
Posts: 128
David Newton wrote:Please KeepItDown.

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

1) What does BTree.add(int) do?
2) What does the Node constructor do?
3) Question answered, correct?

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

Joined: Sep 29, 2008
Posts: 12617

The same value it was constructed with.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Binary tree