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

trees

Higgledy Smith
Ranch Hand

Joined: Mar 07, 2006
Posts: 192
I am trying to understand how to program a solution in trees. Somehow my gets lost between tree theory and applying that theory in code.

Does anyone have (or know a site) to a tree problem that I can use to learn programming trees, preferably a Java solution?

Thanks
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

I would start by googling for java tree sample code. (Note: When I tried it, the first site that came up was roseindia. Avoid that site. It's riddled with errors.)
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2712
    
    5

What particular tree are you trying to program?

There are many types of trees in programming, I am assuming that you are talking of a plain old binary tree.
I was thinking of the program and recalled the days when I was learning data structures for the first time
Its fun.
To start with, a tree node looks something like the following code.



Constructing tree is not much tricky as tree traversal is ;).

P.S The above quick code is inspired from my C/C++ way of doing it. There can be better way of doing it in Java.


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trees
 
Similar Threads
How to display trees in JavaScript?
Trees in JSF?
Tree problem
Tree sources
How to check whether two trees have identical structure ?