I am working on my thesis work that is relevant to the artificial intelligent domain.
I want to make a real time recommendation system so I need to represent the decisions with a tree.
My main question is how can I represent this tree in an efficient way? I want to mention that the tree will be traversing both bottom-up and up to bottom. Also the tree is not binary and the node that it has are quite many (over 100).
Right now I have create a node class like the above:
public class node {
    private String nodeName;
    private expectedValue ev;
    private boolean isLeaf;
    private boolean isRoot;
    private List<node> listOfChildren = new ArrayList<node>();
    private node parent;
    public node(String nodeName) {
        super();
        this.nodeName = nodeName;
    }
    public node(String nodeName, boolean isLeaf, boolean isRoot, List<node> listOfChildren, node parent) {
        super();
        this.nodeName = nodeName;
        this.isLeaf = isLeaf;
        this.isRoot = isRoot;
        this.listOfChildren = listOfChildren;
        this.parent = parent;
    }
    public void initializeNode(boolean isLeaf, boolean isRoot, List<node> listOfChildren, node parent) {
        this.isLeaf = isLeaf;
        this.isRoot = isRoot;
        this.listOfChildren = listOfChildren;
        this.parent = parent;
    }
    //getter and setter here......  
}
But I believe that it is not the most efficient way to represent a tree....
So, what is an efficient way to represent a tree in Java and is there a way to create the tree dynamically or do I have to initialise it one by one node?
Thank you!
 
     
    