private Block getSmallestBlock(BTNode T,int Size, Block min)
        {
            if (T == null)
                return new Block(-1,9999999,false);

            Block minLeft = getSmallestBlock(T.left(), Size, min);
            Block minRight = getSmallestBlock(T.right(), Size, min);

            if ((minLeft.Size < minRight.Size)&&(minLeft.Size > Size))
                min = minLeft;
            else if (minRight.Size > Size)
                min = minRight;

            Block curBlock = (Block)T.value();

            if ((curBlock.Size > Size)&&(min.Size > curBlock.Size))
                min = curBlock;

            return min;
        }
 private Block recursiveFindMemory(BTNode T, int Size, Block CurMin)
 {
     if (T != null)
     {
         if (((Block)T.value()).Size < CurMin.Size)
         {
             Block temp = (Block)T.value();
             recursiveFindMemory(T.left(), Size, temp);
             recursiveFindMemory(T.right(), Size, temp);
         }
         else
         {
             recursiveFindMemory(T.left(), Size, CurMin);
             recursiveFindMemory(T.right(), Size, CurMin);
         }
     }
     return CurMin;
 }