36.
Coefficient = 4C2 * (2)2 * (-3)2 = 6 * 4 * 9 = 216
37. P(7, 6) = 7! / (7-6)! = 5040
38. C(10, 8) = 10!/ [(10-8)! * 8!] = 10!/(2! * 8!) = 10 * 9 / 2 = 45
39.
factorial(4) = 4 * factorial(3) = 4 * 3 * factorial(2) = 4 * 3 * 2 * factorial(1) = 4 * 3 * 2 * 1 * factorial(0)
= 4 * 3 * 2 * 1 * 1
= 24
NOTE: As per Chegg policy, I am allowed to answer only 4 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
permutations are there with people)? 34. A class has enough time for 4 questions. 10 students...
Recursive definition for factorial: a0 = 1, an = n * an-1 procedure factorial(n: nonnegative integer) if n = 0 then return 1 else return n * factorial( n - 1 ) Trace the execution of the factorial algorithm described above for input 7. Track the number of times factorial is invoked (with the first invocation with input 7 as invocation 0) and the value returned by each invocation.
public class Permutations
{
// Helper method for outputting an array.
private static void PrintArray(string[] array)
{
foreach (string element in array)
{
Console.Write($"{element} ");
}
Console.WriteLine();
}
// Helper method for invoking Generate.
private static void Generate(string[] array)
{
Generate(array.Length, array);
}
public static void Main(string[] args)
{
}
}
procedure generate(k : integer, A : array of any):
if k = 1 then
output(A)
else
// Generate permutations with kth unaltered
// Initially k == length(A)
generate(k -...
10 Q100 Combinations and Permutations Directions: Apply the combination formula to solve the problems below. Each answer must be an integer. Do not use scientific notation. 2 points each. Problem 1: A group of 20 people are carpooling in an 7 passenger van. How many different way can a group of 7 be selected. Problem 2: In a class of 13 students, how many ways can a club of 6 students be arranged? Problem 3: Problem 2) 14 students put...
The following algorithm (Rosen pg. 363) is a recursive version of linear search, which has access to a global list of distinct integers a_1, a_2,..., a_n. procedure search(i, j, x : i,j, x integers, 1 < i < j < n) if a_i = x then return i else if i = j then 4. return 0 else return search(i + 1, j, x) Prove that this algorithm correctly solves the searching problem when called with parameters i = 1...
I just need to add comment for the code blow. Pleas add comment for each method and class if comments left out. package exercise01; /*************************************************************************** * <p> This program demonstrates the technique of recursion and includes * recursive methods that are defined for a variety of mathematical * functions. * * <br>A recursive method is one that directly or indirectly calls itself * and must include: * <br>(1) end case: stopping condition * which terminates/ends recursion * <br>(2) reduction:...
Meet is an operation between zero-one matrices and uses Boolean products (C. Join is an operation between zero-one matrices and uses Boolean products d. Join is an operation between zero-one matrices and uses conjunctions 29. Given set S (-2, -1, 0, 1, 2), R is a relation on S. i. R ( (x, y)| x-y 1} Write R as a set of ordered pairs. (Use roster method to write R as a set of tuples) 3pts ill. and matrix representation...
Written in expanded form, the usual factorial function is n! = n middot (n - 1) middot (n - 2) ... 3 middot 2 middot 2 middot 1. The difference between elements in the product is always 1. It can be writ in recursive form as n! = n middot (n - 1)! (e.g., 10! = 10 middot 9!, 23! * 23 middot 22!, 4! = 4 3!, etc.). The purpose of this problem is to generalize the factorial function...
Consider a class Fraction of fractions. Each fraction is signed and has a numerator and a denominator that are integers. Your class should be able to add, subtract, multiply, and divide two fractions. These methods should have a fraction as a parameter and should return the result of the operation as a fraction. The class should also be able to find the reciprocal of a fraction, compare two fractions, decide whether two fractions are equal, and convert a fraction to...
2. In class, we discussed the problem of searching for an item x in a sorted array L with n entries. The returned value is supposed to be -1 if the value x is not in the array, and the index i such that L[i] = x if x is in the array. Assume that I does not contain duplicate values. Now consider the decision trees of algorithms for solving this problem. To make the decision tree more explicit, we...
Discrete Math
Give a big-Theta estimate for the number of additions in the following algorithm a) procedure f (n: integer) bar = 0; for i = 1 to n^3 for j = 1 to n^2 bar = bar + i + j return bar b) Consider the procedure T given below. procedure T (n: positive integer) if n = 1 return 2 for i = 1 to n^3 x = x + x + x return T(/4) + T(/4) +...