File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Trees Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trees" Watch "Trees" New topic
Author

Trees

Navin Singh
Greenhorn

Joined: Nov 14, 2001
Posts: 1
I have a servlet which reads in a bunch of ints and stores them into a binary search tree. I am printing out the tree in level order using a queue. Does anyone generally know an algorithm, pseudocode, or code to determine how I would calculate the height of the tree and the depth of each node. Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15629
    
  15

A good book on algorithms would help. There's one I have from MIT press that devotes a lot of space to graphs (trees). I believe it's named "Algorithms" or something like that.
You could also ask in the general Java forums, since running in a serlvet environment isn't going to make any difference.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trees
 
Similar Threads
WA#2 word association
Tad Tree
WA #1.....word association
instanceOf??
WA #2 ..... word association