コード例 #1
0
ファイル: TreeOperation.cs プロジェクト: MohammadUT/IRI.Japey
        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));
 }