代码片段如下:
class Node{
public int val;
public List<Node> children;
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
public List<Node> getChildren() {
return this.children;
}
public void setChildren(List<Node> children) {
this.children = children;
}
public Node() {}
public Node(int val,List<Node> children) {
this.val = val;
this.children = children;
}
}
class Tree{
Node rootNode;
Node[] nodes=new Node[10];
List<Node> tempChildren=new Vector<Node>();
List<Node> Children1=new Vector<Node>();
List<Node> Children2=new Vector<Node>();
List<Node> Children3=new Vector<Node>();
List<Node> Children4=new Vector<Node>();
Queue<Node> childrenQue=new LinkedList<Node>();
public Tree() {
// TODO Auto-generated construc