Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1 (2 pts): How many one-to-one functions are there from a set of cardina

ID: 642982 • Letter: P

Question

Problem 1 (2 pts): How many one-to-one functions are there from a set of cardinality 10 to sets with the following cardinalities? (a) 8, (b) 10, (c) 12, (d) 14.

Problem 2 (3 pts): A palindrome is a string whose reversal is identical to the string. How many strings using lower-case letters a,b,...,z of length n are palindromes?

Problem 3 (3 pts): Let n be a positive integer. Show that among any group of n + 1 (not necessarily consecutive) positive integers there are at least two with the same reminder when they are divided by n.

Problem 4 (3 pts.): Write (and test) a program which, for an input n ? {0,1,...} and a 6= 0, computes

Provide both the program and the computed results for n = 10,50,100 and a of your choice. Verify whether the computed results are equal to a ? n ? (n + 1)/2.

Problem 1 (2 pts): How many one-to-one functions are there from a set of cardinality 10 to sets with the following cardinalities? (a) 8, (b) 10, (c) 12, (d) 14. Problem 2 (3 pts): A palindrome is a string whose reversal is identical to the string. How many strings using lower-case letters a,b,...,z of length n are palindromes? Problem 3 (3 pts): Let n be a positive integer. Show that among any group of n + 1 (not necessarily consecutive) positive integers there are at least two with the same reminder when they are divided by n. Problem 4 (3 pts.): Write (and test) a program which, for an input n ? {0,1,...} and a 6= 0, computes sn = Sigma a*1 using recursion. Provide both the program and the computed results for n = 10,50,100 and a of your choice. Verify whether the computed results are equal to a ½ n ½ (n + 1)/2.

Explanation / Answer

1.(a) 8

(b) 10

(c) 10

(d) 10

----------------------------------------------------------------------------------------------------------------------------------------------------------

2. step1 : This problem can solved just by finding permutations of a -z in 26 places ( repetition allowed )

step2: divide 26 place into two parts. find permutations for first 13 places, and fill remaining 13 places in reverse order.

Step3: print 26 places at the end of each permutation . total palindromes (13*13) 26

code ::

//calling convention permutations( input, permute, 26, 0);

void permutations(char Input[], char permute[], int n, int index )
{
int i=0;
// printing palindrome
if( index == n )
{
for( i =0 ;i < n; i++ )
printf("%d, ", Permute[i] );
for( i =n-1 ;i >= 0; i--)
printf("%d, ", Permute[i] );
Printf(" ");

return ;
}

for (i = 0 ; i < n; i++)
{
Permute[index] = Input[i];

permutations( Input, permute, n, index +1 );
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote