This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to find Path with Max weight Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to find Path with Max weight" Watch "How to find Path with Max weight" New topic
Author

How to find Path with Max weight

Harry Singh
Ranch Hand

Joined: May 02, 2001
Posts: 124
Hi Guru's,

I have created a tree with all the tree nodes and then stored everything in TreeMap and this way i have created a tree with each tree node having refernce to its parent and children...

So can anyone tell me ho can i traverse this tree to find the maximum weight (profit)by following path in the tree...

Class Tree Node is



and i am constructing a Tree as



so can Anyone telll me how can i find a path which is having max weight..i Actually dont need a path, i just need to get max weight (profit)..

Any ideas...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to find Path with Max weight