Results 1 to 2 of 2
Thread: Node tree with weights
- 05-07-2012, 12:37 AM #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.
- 05-07-2012, 06:15 AM #2
Member
- Join Date
- Sep 2011
- Posts
- 59
- Rep Power
- 0
Similar Threads
-
How to invoke a tree as if a node selected ?
By johny2011 in forum Advanced JavaReplies: 5Last Post: 05-13-2011, 08:49 AM -
How to insert node to tree while comparing string instead of int
By Javanoobs in forum Advanced JavaReplies: 4Last Post: 04-18-2011, 06:32 AM -
How to insert node to tree while comparing string instead of int
By Javanoobs in forum New To JavaReplies: 0Last Post: 04-17-2011, 04:57 PM -
How to sample a node from a binary tree efficiently?
By malaguena in forum Advanced JavaReplies: 0Last Post: 03-12-2011, 05:57 PM -
How to capture a tree node edit ?
By ni4ni in forum AWT / SwingReplies: 1Last Post: 03-11-2011, 05:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks