public static void Main() { Tree t = new Tree(); t.Add(10); t.Add(8); t.Add(14); t.Add(12); t.Add(113); t.Add(11); t.Add(7); t.Add(9); Tree.Print(t); Console.WriteLine(t.Find(12)); Console.WriteLine(t.TwoNodes()); }
static void Main(string[] args) { Tree tree; int[] players = new int[1000000]; string[] input = Console.ReadLine().Split(); while (input[0] != "T") { input = Console.ReadLine().Split(); } tree = new Tree(Convert.ToInt16(input[1]), Convert.ToInt16(input[2])); input = Console.ReadLine().Split(); while (input.Length > 0) { switch (input[0]) { case "T": tree.Insert(ref tree, Convert.ToInt16(input[1]), Convert.ToInt16(input[2])); tree.ReBalance(ref tree); players[Convert.ToInt16(input[1])] = Convert.ToInt16(input[2]); break; case "G": tree.PrintTen(tree, Convert.ToInt16(input[1]), players[Convert.ToInt16(input[1])]); break; case "R": tree.GetRank(tree, Convert.ToInt16(input[1]), Convert.ToInt16(input[2])); break; default: break; } input = Console.ReadLine().Split(); } tree.PrintHeights(tree); Console.WriteLine(); tree.Print(tree); Console.ReadLine(); }