1. Member
Join Date
Sep 2011
Posts
59
Rep Power
0

Node tree with weights

Question:

You are given are a set of nodes that are connected to each other, each connection has a weighted value. Output the node to start from in order to achieve the greatest total weight. Each Node can only be "connected to" once: If the connection from node A to node B is used, no other connections TO node B can be used.
Multiple branches can also be possible.
A>B>C
A>D>F
If starting at A, both branches are traversed.

Given Info:
Number of nodes
Node connections with weights

Sample Input:

3//number of nodes
0, 1, 4//node connection with weight
0, 2, 1
1, 2, 3
-1//string to signify end of input

Sample Output:
Start at Node A with a total of 7.

I already have a working program that solves this but I just want to see how others would go about tackling this problem.
Are there any Objects or libraries in java that I'm not aware of that could make this simple?
Last edited by brynpttrsn; 05-07-2012 at 12:51 AM.

2. Member
Join Date
Sep 2011
Posts
59
Rep Power
0

Re: Node tree with weights

No takers? (Should this go in advanced or something?)

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•