示例#1
0
 public int SumMinValue()
 {
     if (mMinValue == int.MaxValue)
     {
         if (mLeftChild != null && mRightChild != null)
         {
             mMinValue = mValue + Math.Min(mLeftChild.SumMinValue(), mRightChild.SumMinValue());
         }
         else if (mLeftChild != null)
         {
             mMinValue = mValue + mLeftChild.SumMinValue();
         }
         else if (mRightChild != null)
         {
             mMinValue = mValue + mRightChild.SumMinValue();
         }
         else
         {
             mMinValue = mValue;
         }
     }
     return(mMinValue);
 }
示例#2
0
 public int SumMinValue()
 {
     return(mRoot.SumMinValue());
 }