示例#1
0
        static void Main(string[] args)
        {
            TestBST();

            ///////// Least coin combination for a number N with goven denominations coins
            int[] coins    = new int[] { 4, 6, 7 };
            int   numCoins = Arithmatics.StartGetLeastCoinsForANumber(coins, -17);

            numCoins = Arithmatics.StartGetLeastCoinsForANumber(coins, 4);

            //Find Longest pelindrome - O(n^2)
            string rawString = "abfdracecarabaortitabcdef";

            Console.WriteLine(StringMan.FindLongestPelindromeON2(rawString));

            //Find Longest pelindrome - O(n)
            Console.WriteLine(StringMan.FindLongestPelindromeON(rawString));

            rawString = "abcdcaacden";
            Console.WriteLine(StringMan.FindLongestPelindromeON(rawString));



            ////////// Make BST Out of an array.
            int[]      arr  = new int[] { 16, 4, 1, 5, 21, 10, 17, };
            Node <int> root = BSTBroker.PrepareBSTFromArray(arr);

            arr  = new int[] { 16, 4, 1, 5, 4, 21, 10, 17, };
            root = BSTBroker.PrepareBSTFromArray(arr);
        }
示例#2
0
        static void Main1(string[] args)
        {
            string rawString = "abfdracecarabaortitabcdef";

            Console.WriteLine(StringMan.FindLongestPelindromeON2(rawString));

            TestBST();
        }