tree algorithm example
Example: tree algorithm example
public class Tree {
private Node root;
public Tree(T rootData) {
root = new Node();
root.data = rootData;
root.children = new ArrayList>();
}
public static class Node {
private T data;
private Node parent;
private List> children;
}
}