Высота вершины Бинарного Поискового Дерева - C#
Формулировка задачи:
Как при помощи обратного обхода расставить метки высот вершин?
Решение задачи: «Высота вершины Бинарного Поискового Дерева»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace BinaryTree
{
class Program
{
static void Main()
{
Tree tr = new Tree();
int a;
List<int> list = new List<int>();
using (StreamReader sr = File.OpenText("d:\\input.txt"))
{
String str=null;
a = Int32.Parse(sr.ReadLine());
sr.ReadLine();
while((str = sr.ReadLine())!=null)
{
int in1 = Int32.Parse(str);
list.Add(in1);
}
}
foreach(int i in list)
{
tr.Insert(i);
}
tr.Delete1(a);
tr.Print();
tr.p();
}
}
}