Skip to content

Instantly share code, notes, and snippets.

@Jingbang-liu-lix
Created November 7, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jingbang-liu-lix/2bbcb6a5dde6d723676e7fbc11641709 to your computer and use it in GitHub Desktop.
Save Jingbang-liu-lix/2bbcb6a5dde6d723676e7fbc11641709 to your computer and use it in GitHub Desktop.
Tree Implementation
public class EvalTree<T> implements AbstractEvalTree<T> {
/**
* All nodes in the evaluation tree. Root node is the first element of the array with 0th index.
*\
*/
AbstractEvalNode[] _nodes;
/**
* Length of list of children of a node in {@link #_nodes}.
* <code>_childCounts[i]</code> corresponds to number of children of <code>_nodes[i]</code>
*/
byte[] _childCounts;
/**
* Position of the first child of a given node of evaluation tree in {@link #_nodes} or -1 if a node does not have children.
* <code>_childListStartPositions[i]</code> corresponds to starting position of a list of children of <code>_nodes[i]</code>
*/
short[] _childListStartPositions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment