public static BinarySearchNode <T> GetPredecessor <T>(BinarySearchNode <T> node) where T : IComparable { if (node.LeftChild != null) { return(TreeOperation.GetMaximum(node.LeftChild)); } BinarySearchNode <T> result = node.Parent; while (result != null && result.LeftChild == node) { node = result; result = node.Parent; } return(result); }
public BinarySearchNode <T> GetPredecessor(BinarySearchNode <T> node) { return(TreeOperation.GetPredecessor(node)); }
public BinarySearchNode <T> Search(T value) { return(TreeOperation.LookFor(this.Parent, value)); }