construct a tree with edges

Job ID: 35199999

Budget: $10 – $30 CAD

construct a tree with given array of edges

Some important points to note:
• 1 is the root node
• There is no duplicated edge
• There is no isolated node
• Thus N nodes, n-1 edges
• Positions in the tuple do not indicate direction
Sample tree node class:
Node {
int value;
List<Node> children;
}
Related categories: JavaScript Algorithm