Public Abstract Class Heightbalancedtree Implements Collection Node Root Int Size Node Nul Q37050440

public abstract class HeightBalancedTree<T extendsComparable<T>> implements Collection<T>{
Node root;
int size;
Node nullNode; // node to serve as null pointer
/* Indices for the nodes returned by deleteNode() */
protected final static int DELETED = 0;
protected final static int REPLACED = 1;
protected final static int PARENT = 2;
/* Node class used for storing the structure of the tree */
protected class Node<T>{
protected Node left, right, parent;
protected T data;   
protected Node(Node l, Node r, Node p , T d){
left = l;
right = r;
parent = p;
data = d;
}
}
/* Construct an emepty height balancing tree */
public HeightBalancedTree(){
size = 0;
nullNode = null;
root = nullNode;
}   
/**
* Balances the tree after an

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.