int l1 = U.Length, l2 = V.Length;
int[] X = new int[l1 + l2];
U.CopyTo(X, 0);
for (int i = 0; i < l2; i++)
{
      X[l1] = V[i];
      l1++;
}
Array.Sort(X);
public class Node
{
    public string Value;
    public Node Left;
    public Node Right;
}
static void Traversal(Node root)
{
     Queue<Node> queue = new Queue<Node>();
     if(root!=null) queue.Enqueue(root);
     Node temp;
     while (queue.Count>0)
     {
         temp = queue.Dequeue();
         Console.WriteLine(temp.Value);
         if(temp.Left!=null) queue.Enqueue(temp.Left);
         if(temp.Right!=null) queue.Enqueue(temp.Right);
      }
}

解决方案 »

  1.   

            static string LargeNumAdd(string a, string b)
            {
                int len1 = a.Length;
                int len2 = b.Length;
                int carry = 0; //进位
                Stack<int> stack1 = new Stack<int>(len1);
                Stack<int> stack2 = new Stack<int>(len2);
                int resultLen = len1 >= len2 ? len1 : len2;
                Stack<int> stack3 = new Stack<int>(resultLen+1);
                for (int i = 0; i < len1; i++)
                {
                    int num = Convert.ToInt32(a[i].ToString());
                    stack1.Push(num);
                }
                for (int i = 0; i < len2; i++)
                {
                    int num = Convert.ToInt32(b[i].ToString());
                    stack2.Push(num);
                }
                int tempResult = 0;
                for (int i = 0; i < resultLen; i++)
                {
                    int r1 = stack1.Count > 0 ? stack1.Pop() : 0;
                    int r2 = stack2.Count > 0 ? stack2.Pop() : 0;
                    tempResult = r1 + r2 + carry;
                    if (tempResult > 9)
                    {
                        stack3.Push(tempResult - 10);
                        carry = 1;
                    }
                    else
                    {
                        stack3.Push(tempResult);
                        carry = 0;
                    }
                }
                if (carry > 0) stack3.Push(carry);
                StringBuilder sb = new StringBuilder();
                while (stack3.Count > 0)
                {
                    sb.Append(stack3.Pop());
                }
                return sb.ToString();
            }
      

  2.   

    sorry,my english is poor.