Results 1 to 2 of 2
  1. #1
    brynpttrsn is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Node tree with weights


    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.
    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. #2
    brynpttrsn is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default Re: Node tree with weights

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

Similar Threads

  1. How to invoke a tree as if a node selected ?
    By johny2011 in forum Advanced Java
    Replies: 5
    Last Post: 05-13-2011, 08:49 AM
  2. Replies: 4
    Last Post: 04-18-2011, 06:32 AM
  3. Replies: 0
    Last Post: 04-17-2011, 04:57 PM
  4. How to sample a node from a binary tree efficiently?
    By malaguena in forum Advanced Java
    Replies: 0
    Last Post: 03-12-2011, 05:57 PM
  5. How to capture a tree node edit ?
    By ni4ni in forum AWT / Swing
    Replies: 1
    Last Post: 03-11-2011, 05:21 AM

Posting Permissions

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