static void Main(string[] args) { Tree Data = new Tree(); //Adding Data in a tree Data.Add(12); Data.Add(4); Data.Add(9); Data.Add(50); Data.Add(1); Console.WriteLine("PreOrder"); Data.Print(); Console.WriteLine("Level Order"); Data.PrintLevelOrder(); Console.WriteLine("Spiral Order"); Data.PrintSpiralOrder(); Data.Search(-1); Console.ReadKey(); }
static void Main(string[] args) { Tree tree = new Tree(); tree.AddNode(3); tree.Insert(tree.root, tree.AddNode(2)); tree.Insert(tree.root, tree.AddNode(1)); tree.Insert(tree.root, tree.AddNode(4)); tree.Insert(tree.root, tree.AddNode(10)); tree.Insert(tree.root, tree.AddNode(6)); tree.Print(tree.root); }