public static void Main(string[] args) { int[] numbers = { 4, 7, 2, 6, 8, 3, 1 }; BSTTree tree = new BSTTree(); foreach (var n in numbers) { tree.Add(n); } Console.WriteLine("Height of tree: " + tree.Height()); Console.WriteLine("Tree is balances? " + tree.IsBalanced().ToString()); }
public static void Main(string[] args) { int[] numbers = { 4, 7, 2, 6, 8, 3, 1 }; BSTTree tree = new BSTTree(); foreach (var n in numbers) { tree.Add(n); } Console.WriteLine("Distance between 4 and 6: " + tree.FindDistance(4, 6).ToString()); // expected: 2 Console.WriteLine("Distance between 3 and 6: " + tree.FindDistance(3, 6).ToString()); // expected: 4 Console.WriteLine("Distance between 3 and 6: " + tree.FindDistance(2, 8).ToString()); // expected: 3 }