示例#1
0
        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);
        }
示例#2
0
 public BinarySearchNode <T> GetPredecessor(BinarySearchNode <T> node)
 {
     return(TreeOperation.GetPredecessor(node));
 }
示例#3
0
 public BinarySearchNode <T> Search(T value)
 {
     return(TreeOperation.LookFor(this.Parent, value));
 }