Пример #1
0
 public void growTree(int maxHeight, String indent)
 {
     //Console.WriteLine(indent + m_weight.ToString());
     if (maxHeight > 0)
     {
         m_leftChild = new Node();
         m_leftChild.growTree(maxHeight - 1, indent + " ");
         m_rightChild = new Node();
         m_rightChild.growTree(maxHeight - 1, indent + " ");
     }
     else
         m_leftChild = m_rightChild = null;
 }
Пример #2
0
 private static int Main()
 {
     Node root = new Node();
     root.growTree(4, "");
     root.rotateTree(ref root.m_leftChild.m_weight, ref root.m_rightChild.m_weight);
     return 100;
 }
Пример #3
0
 private static int Main()
 {
     try
     {
         Node root = new Node();
         root.growTree(6, "").rotateTree(
             ref root.m_leftChild.m_weight,
             ref root.m_rightChild.m_weight);
     }
     catch (Exception)
     {
         Console.WriteLine("*** FAILED ***");
         return 1;
     }
     Console.WriteLine("*** PASSED ***");
     return 100;
 }