static void Main(string[] args) { Console.WriteLine("Binary Tree Implimentation!"); BinarySearchTree <int> binarySearchTree = new BinarySearchTree <int>(56); binarySearchTree.Insert(30); binarySearchTree.Insert(70); binarySearchTree.Insert(22); binarySearchTree.Insert(40); binarySearchTree.Insert(60); binarySearchTree.Insert(95); binarySearchTree.Insert(11); binarySearchTree.Insert(3); binarySearchTree.Insert(16); binarySearchTree.Insert(63); binarySearchTree.Insert(67); // binarySearchTree.Insert(16); binarySearchTree.Display(); binarySearchTree.GetSize(); if (binarySearchTree.Search(11, binarySearchTree)) { Console.WriteLine("11 is found in BST"); } else { Console.WriteLine("Not Found"); } }
static void Main(string[] args) { Console.WriteLine("Binary Tree Implimentation!"); BinarySearchTree <int> binarySearchTree = new BinarySearchTree <int>(56); binarySearchTree.Insert(20); binarySearchTree.Insert(65); binarySearchTree.Insert(24); binarySearchTree.Insert(33); binarySearchTree.Insert(98); binarySearchTree.Insert(95); binarySearchTree.Insert(34); binarySearchTree.Insert(77); binarySearchTree.Insert(5); // binarySearchTree.Insert(16); binarySearchTree.Display(); binarySearchTree.GetSize(); if (binarySearchTree.Search(5, binarySearchTree)) { Console.WriteLine("5 is found"); } else { Console.WriteLine("5 is not found"); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); BinarySearchTree <int> binarySearch = new BinarySearchTree <int>(56); binarySearch.Insert(30); binarySearch.Insert(70); binarySearch.Insert(22); binarySearch.Insert(40); binarySearch.Insert(95); binarySearch.Insert(11); binarySearch.Insert(65); binarySearch.Insert(3); binarySearch.Insert(60); binarySearch.Insert(16); binarySearch.Insert(63); binarySearch.Insert(67); binarySearch.Display(); //bool result = binarySearch.IfExists(67, binarySearch); //Console.WriteLine(result); Console.ReadKey(); }