Пример #1
0
        static void Main(string[] args)
        {
            var firstTree = new BTN();

            firstTree.Value = 1;
            var secondTree = new BTN();

            secondTree.Value = 1;

            Console.WriteLine(TreeComparator.Compare(firstTree, secondTree));
            Console.ReadKey();
        }
Пример #2
0
 public static bool Compare(BTN first, BTN second)
 {
     if (first == null && second == null)
     {
         return(true);
     }
     else if (first != null && second != null)
     {
         return(first.Value == second.Value && Compare(first.Left, second.Left) && Compare(first.Right, second.Right));
     }
     else
     {
         return(false);
     }
 }