Beispiel #1
0
        public int Height()
        {
            //    get
            //    {
            int leftHeight  = LeftChild == null ? 0 : LeftChild.Height();
            int rightHeight = RightChild == null ? 0 : RightChild.Height();

            return(Math.Max(leftHeight, rightHeight) + 1);
            //if (ChildCount == 0)
            //{
            //    return 1;
            //}
            //if (LeftChild.Height > RightChild.Height)
            //{
            //    return LeftChild.Height + 1;
            //}
            //return RightChild.Height + 1;
            //  }
        }
Beispiel #2
0
 void UpdateHeight(Node <T> node)
 {
     int temp = node.Height();
 }