コード例 #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");
        }