Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IPerson person = new Joe();

            Joe me = new Joe();

            me.AddFirst(2);

            IPerson meToo = me;

            meToo.AddFirst(3);



            //RemoteAPI.InitClient();

            //MyGeneric<string> name = new MyGeneric<string>();
            //name.data = "A string value";

            //MyGeneric<float> version = new MyGeneric<float>();
            //version.data = 5.0F;

            //Console.WriteLine(name.data);// displays “A string value”
            //Console.WriteLine(version.data);// displays 5

            //LinkedList<int> myList = new LinkedList<int>();

            //myList.AddHead(3);
            //myList.AddHead(1);
            //myList.AddHead(1);

            //myList.PrintList();

            //String wordToCount = "aa";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");

            //wordToCount = "ab";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");

            //wordToCount = "abc";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");

            //wordToCount = "ramona";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");

            //wordToCount = "abba zabba";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");

            //wordToCount = "mississippi";
            //Console.WriteLine("The word " + wordToCount + " can be reordered in " + countPermutations(wordToCount) + " ways");


            //char[] str = PrepUrlify("How do you do when I s a y things?");
            //int trueLength = GetTrueLength(str);
            //string urlified = URLify(str, trueLength);
            //Console.WriteLine(urlified);
            //char[] str = PrepUrlify("How do you do when I say things?");
            //int trueLength = GetTrueLength(str);
            //string urlified = URLifyAlt(str, trueLength);
            //Console.WriteLine(urlified);


            //int n = 2;
            //int m = 5;
            //Console.WriteLine(Multiply(n, m));
            //Console.WriteLine(InneficientMultiply(n, m));

            //int[,] matrix = new int[4, 4] { { 2, 1, 9, 3 }, { 1, 2, 3, 1 }, { 1, 3, 2, 1 }, { 3, 1, 1, 2 } };

            //Console.WriteLine("Matrix 1");
            //int[,] matrix = new int[4, 4] { { 0, 1, 9, 3 }, { 1, 2, 2, 1 }, { 1, 3, 2, 1 }, { 3, 1, 1, 0 } };
            //printMatrix(matrix);

            //matrix = rotateMatrix(matrix);
            ////printMatrix(matrix);

            //matrix = rotateMatrix(matrix);
            ////printMatrix(matrix);

            //matrix = rotateMatrix(matrix);
            ////printMatrix(matrix);

            //matrix = rotateMatrix(matrix);
            //printMatrix(matrix);

            //matrix = zeroMatrix(matrix);
            //printMatrix(matrix);

            //Console.WriteLine("Matrix 2");
            //matrix = new int[3, 5] { { 2, 1, 1, 1, 1 }, { 1, 1, 3, 1, 0 }, { 1, 3, 2, 1, 0 } };
            //printMatrix(matrix);

            //matrix = zeroMatrix(matrix);
            //printMatrix(matrix);

            //matrix = new int[4, 4] { { 0, 1, 9, 3 }, { 1, 2, 2, 1 }, { 1, 3, 2, 1 }, { 3, 1, 1, 0 } };
            //matrix = zeroMatrixImproved(matrix);
            //printMatrix(matrix);

            //CollectionsPractice();


            //int a = 10;
            //int b = 12;
            //Console.WriteLine("OR: " + BitWiseOperation(BitWiseOperator.Or, a, b));
            //Console.WriteLine("AND: " + BitWiseOperation(BitWiseOperator.And, a, b));
            //Console.WriteLine("XOR: " + BitWiseOperation(BitWiseOperator.Xor, a, b));


            //Console.WriteLine(Multiply(30, 30));
            //Console.WriteLine(Multiply(1003, 3));

            //string s1 = "absc";
            //string s2 = "scax";
            //Console.WriteLine(isPermutation(s1, s2));
            //Console.WriteLine(isPermutationEnhanced(s1, s2));
            //Console.WriteLine(IsUniqueString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZa"));
            //Console.WriteLine(IsUniqueString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));
            //Console.WriteLine(IsUniqueStrinAlt("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZa"));
            //Console.WriteLine(IsUniqueStrinAlt("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"));


            //Console.WriteLine(isRotation("rotation","ionrotat"));
            //Console.WriteLine(isRotation("rotation", "ionrott"));
        }