Ejemplo n.º 1
0
        static void PopulateValues()
        {
            var obj   = new TreesNGraph();
            var input = new List <string>
            {
                "+-++++++++",
                "+-++++++++",
                "+-++++++++",
                "+-----++++",
                "+-+++-++++",
                "+-+++-++++",
                "+++++-++++",
                "++------++",
                "+++++-++++",
                "+++++-++++"
            };

            var cities = new List <string>
            {
                "LONDON", "DELHI", "ICELAND", "ANKARA"
            };

            obj.PopulateWords(input, cities);
            obj.DrawWords();
            // obj.ChooseWords();
        }
Ejemplo n.º 2
0
        static void SumPath()
        {
            var obj   = new CareerCupQnA();
            var treeO = new TreesNGraph();

            obj.SumPath(treeO.PopulateBinarySTree(), 28);
        }
Ejemplo n.º 3
0
        static void FindMax()
        {
            var obj        = new TreesNGraph();
            var binaryTree = obj.PopulateBinaryTree();

            Console.WriteLine(obj.FindMax(binaryTree));
        }
Ejemplo n.º 4
0
        public static void FindItsParent()
        {
            var obj  = new CareerCupQnA();
            var obj1 = new TreesNGraph();


            obj.FindItsParent(obj1.PopulateBinaryTree(), 5, 0);
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
0
        public static void CallingFindingRoutes()
        {
            var obj = new TreesNGraph();
            var gh  = obj.PopulateGraph();

            Console.WriteLine("Finding the routes start");
            Console.WriteLine(obj.FindingTheRouteBTW2Nodes(gh, 1, 89));
            Console.WriteLine("Finding the routes ends");
        }
Ejemplo n.º 7
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");
        }
Ejemplo n.º 8
0
        public static void CallingBFS()
        {
            var obj   = new TreesNGraph();
            var graph = obj.PopulateGraph();

            Console.WriteLine("BFS Starts");
            obj.BFS(graph);
            Console.WriteLine("BFS Ends");
        }
Ejemplo n.º 9
0
        static void CheckBST()
        {
            var obj        = new CareerCupQnA();
            var obj1       = new TreesNGraph();
            var binaryTree = obj1.PopulateBinarySTree();

            Console.WriteLine("InOrder Starts");
            Console.WriteLine(obj.CheckBST(binaryTree));
        }
Ejemplo n.º 10
0
        public static void CallingCreateMiniBST()
        {
            var obj = new TreesNGraph();
            var arr = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            Console.WriteLine("Craete Min BST Starts");
            var output = obj.CreateMinimalBinaryTree(arr, 0, arr.Length);

            Console.WriteLine("Craete Min BST Ends");
        }
Ejemplo n.º 11
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");
        }
Ejemplo n.º 12
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");
        }