-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathTreeNodeUtil.java
38 lines (36 loc) · 1.16 KB
/
TreeNodeUtil.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.util.Arrays;
public class TreeNodeUtil {
public static TreeNode getTreeNode() {
TreeNode root = new TreeNode();
root.edges.addAll(Arrays.asList(
new TreeNode.Edge(7),
new TreeNode.Edge(14),
new TreeNode.Edge(3)
));
root.edges.get(0).root.edges.addAll(Arrays.asList(
new TreeNode.Edge(4),
new TreeNode.Edge(3)
));
root.edges.get(0).root.edges.get(0).root.edges.add(new TreeNode.Edge(6));
root.edges.get(2).root = new TreeNode();
root.edges.get(2).root.edges.addAll(Arrays.asList(
new TreeNode.Edge(2),
new TreeNode.Edge(1)
));
root.edges.get(2).root.edges.get(1).root.edges.addAll(Arrays.asList(
new TreeNode.Edge(6),
new TreeNode.Edge(4)
));
root.edges.get(2).root.edges.get(1).root.edges.get(1).root.edges.addAll(Arrays.asList(
new TreeNode.Edge(4),
new TreeNode.Edge(2)
));
root.edges.get(2).root.edges.get(1).root.edges.get(1).root.edges.get(1).root.edges
.addAll(Arrays.asList(
new TreeNode.Edge(1),
new TreeNode.Edge(2),
new TreeNode.Edge(3)
));
return root;
}
}