public static void Main(string[] args) { BinaryTree b = new BinaryTree(); b.Insert(1, "repos1.txt"); b.Insert(6, "repos2.txt"); b.Insert(2, "repos3.txt"); b.Insert(4, "repos4.txt"); b.Insert(5, "repos5.txt"); b.Insert(3, "repos6.txt"); b.Insert(798, "repos7.txt"); b.Insert(998, "repos8.txt"); b.Insert(0, "repos9.txt"); b.Insert(75, "repos10.txt"); b.Insert(56, "repos11.txt"); b.Insert(98790, "repos12.txt"); b.Display(); Console.WriteLine("Insert requested element:"); int element = int.Parse(Console.ReadLine()); string result = b.Search(element); Console.WriteLine("The repository of the requested element is:"); Console.WriteLine(result); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Binary Tree"); BinaryTree binaryTree = new BinaryTree(); binaryTree.CreateTree(); binaryTree.AddToTree(); binaryTree.Display(); Console.WriteLine(); Console.ReadLine(); }
static void Main(string[] args) { BinaryTree binaryTree = new BinaryTree(); binaryTree.Insert(12); binaryTree.Insert(3); binaryTree.Insert(15); binaryTree.Insert(6); binaryTree.Insert(9); binaryTree.Insert(21); binaryTree.Display(); Console.WriteLine("\nBinary Tree Count = {0}", binaryTree.Count()); Console.ReadLine(); }
static void Main(string[] args) { BinaryTree bTree = new BinaryTree(); bTree.Insert(1); bTree.Insert(6); bTree.Insert(2); bTree.Insert(4); bTree.Insert(5); bTree.Insert(3); bTree.Display(); bTree.Search(1); Console.ReadLine(); }
static void Main(string[] args) { BinaryTree tree = new BinaryTree(); tree.RootInsert(13); tree.RootInsert(80); tree.RootInsert(101); tree.RootInsert(1); tree.RootInsert(55); tree.RootInsert(23); tree.RootInsert(72); tree.Search(101); tree.Search(5); tree.Display(); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Binary Search Tree"); BinaryTree <int> bst = new BinaryTree <int>(); bst.AddData(56); bst.AddData(30); bst.AddData(70); bst.AddData(22); bst.AddData(40); bst.AddData(11); bst.AddData(3); bst.AddData(67); bst.AddData(63); bst.Display(bst.rootNode); int h = bst.DepthofTree(bst.rootNode); Console.WriteLine("Height is:" + h); bst.SearchValue(63); }
static void Main(string[] args) { ///creating head node by parameterised constructor BinaryTree <int> binaryTree = new BinaryTree <int>(56); binaryTree.Insert(30); binaryTree.Insert(70); binaryTree.Insert(22); binaryTree.Insert(40); binaryTree.Insert(11); binaryTree.Insert(18); binaryTree.Insert(3); binaryTree.Insert(60); binaryTree.Insert(95); binaryTree.Insert(65); binaryTree.Insert(63); binaryTree.Insert(67); ///Displaying binary tree binaryTree.Display(); binaryTree.GetSize(); binaryTree.Search(63); }