Пример #1
0
        public void Print(int depth)
        {
            PrintShift(depth);
            Console.WriteLine("Key: " + _key + ", Value: " + _value);

            PrintShift(depth);
            if (_parent.HasKey())
            {
                Console.WriteLine("Parent key: " + _parent.GetKey());
            }

            PrintShift(depth);
            Console.WriteLine("{");

            if (_leftChild != null)
            {
                PrintShift(depth + 1);
                Console.WriteLine("Left:");
                _leftChild.Print(depth + 1);
            }

            if (_rightChild != null)
            {
                PrintShift(depth + 1);
                Console.WriteLine("Right:");
                _rightChild.Print(depth + 1);
            }

            PrintShift(depth);
            Console.WriteLine("}");
        }
Пример #2
0
 public void Print()
 {
     Console.WriteLine("Tree:");
     _root?.Print(0);
 }