예제 #1
0
        static void FindMax()
        {
            var obj        = new TreesNGraph();
            var binaryTree = obj.PopulateBinaryTree();

            Console.WriteLine(obj.FindMax(binaryTree));
        }
예제 #2
0
        public static void FindItsParent()
        {
            var obj  = new CareerCupQnA();
            var obj1 = new TreesNGraph();


            obj.FindItsParent(obj1.PopulateBinaryTree(), 5, 0);
        }
예제 #3
0
        static void findtheClosestManager()
        {
            var obj  = new CareerCupQnA();
            var obj1 = new TreesNGraph();
            var tree = obj1.PopulateBinaryTree();

            obj.ClosestManager(tree, 5, 10);
            Console.WriteLine("=============> {0} ", obj.GetClosestCommonManagers());
        }
예제 #4
0
        public static void CallingIsBalanced()
        {
            var obj = new TreesNGraph();
            var bt  = obj.PopulateBinaryTree();

            Console.WriteLine("IsBalanced Starts");
            Console.WriteLine(obj.IsBalancedTree(bt));
            Console.WriteLine("IsBalanced Ends");
        }
예제 #5
0
        public static void CallingCallingBSTToString()
        {
            var obj = new TreesNGraph();
            var arr = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            Console.WriteLine("CallingCallingBSTToString Starts");
            var output = obj.PopulateBinaryTree();

            obj.ConvertBTtoString(output);
            Console.WriteLine(obj.output);
            Console.WriteLine("CallingCallingBSTToStringEnds");
        }
예제 #6
0
        public static void CallingBinaryTreeTraversal()
        {
            var obj = new TreesNGraph();

            var binaryTree = obj.PopulateBinaryTree();

            Console.WriteLine("InOrder Starts");
            obj.InOrder(binaryTree);
            Console.WriteLine("InOrder Ends");
            Console.WriteLine("PreOrder Starts");
            obj.PreOrder(binaryTree);
            Console.WriteLine("PreOrder Starts");
            Console.WriteLine("PostOrder Starts");
            obj.PostOrder(binaryTree);
            Console.WriteLine("PostOrder Starts");
        }