/// <summary> /// Retrieves an ArrayList index from a BinaryNode. /// </summary> /// <param name="t">BinaryNode representing the element to check.</param> /// <returns>Returns an integer if exists, -1 otherwise.</returns> private int ElementAt(BinaryNode t) { return(t == null ? -1 : t.Location); }
/// <summary> /// Searches for and removes the node of a given id. /// </summary> /// <param name="id">The id to be removed.</param> public void Remove(uint id) { root = Remove(id, root); }
/// <summary> /// Sets this.root node to null. /// </summary> public void MakeEmpty() { this.root = null; }
/// <summary> /// Inserts a new element into the BST. /// </summary> /// <param name="id">The id to be inserted.</param> public void Insert(uint id, int loc) { root = Insert(id, loc, root); }
/// <summary> /// Default constructor for a BinarySearchTree (BST) /// The tree is default to null. /// </summary> public BinarySearchTree() { this.root = null; }