Let n be a positive integer. We sample n numbers a1, a2,...,
an
from the set {1,...,n} uniformly at random, with replacement. We
say that
picks i and j with are a match if ai = aj, i < j. What is the
expected total
number of matches? Use indicators.
Let n be a positive integer. We sample n numbers a1, a2,..., an from the set...
Problem 2. Let n be a positive integer. We sample n numbers ai,...,an from the set 1, 2,...,n} uniformly at random, with replacement. Say that the picks i and j with i < j are a match if a -aj. What is the expected total number of matches? Hint: Use indicators. Wİ
You are given a set of integer numbers A = {a1, a2, ..., an}, where 1 ≤ ai ≤ m for all 1 ≤ i ≤ n and for a given positive integer m. Give an algorithm which determines whether you can represent a given positive integer k ≤ nm as a sum of some numbers from A, if each number from A can be used at most once. Your algorithm must have O(nk) time complexity.
The input consists of n numbers a1, a2, . . . , an and a target value t. The goal is to determine in how many possible ways can we add up two of these numbers to get t. Formally, your program needs to find the number of pairs of indices i, j, i < j such that ai+aj = t. For example, for 2, 7, 3, 1, 5, 6 and t = 7, we can get t in two...
Question 6: Let n 2 2 be an integer and let ai,a2,...,an be a permutation of the set (1, 2, . . . ,n). Define ao = 0 and an+1 = 0, and consider the sequence do, 1, d2, l3, . . . , Un, Un+1 A position i with 1 i n is called auesome, if ai > ai-1 and ai > ai+1. In words, i is awesome if the value at position i is larger than both its...
(a) Let R be a commutative ring. Given a finite subset {ai, a2, , an} of R, con- sider the set {rial + r202 + . . . + rnan I ri, r2, . . . , rn є R), which we denote by 〈a1, a2 , . . . , Prove that 〈a1, a2, . . . , an〉 įs an ideal of R. (If an ideal 1 = 〈a1, аг, . . . , an) for some a,...
2 Double summation Let a1, A2, A3, ... be a sequence of real numbers, and let n > 1 be an integer. Which of the following are always equal? пі пп nn nn « ££« Žia. E£« L« i=1 j=1 i=1 j=1 i= 1 i=1 j=1 j=1 i=j
Discrete math question 2. Consider to the following two algorithms procedure SortA(a1,a2, ..., an: a list of real numbers with n 2 2) 1, for j := 2 to n 2. i:= 1 3. while aj > ai 4. 5. m: 6. or k 0toj -i-1 7. i:-i+1 aj-k:aj-k-1 ai := m
15] Dynamic Programming a. We are given a set of matrices Ao.A1, A2.. An-1. which we must multiply in this order. We let (di, di+1) be the dimension of matrix Ai. The minimal number Nuj of operations required to multiply matrices (Ai,Ai+ Aj) is defined by: Explain this formula. 15] Dynamic Programming a. We are given a set of matrices Ao.A1, A2.. An-1. which we must multiply in this order. We let (di, di+1) be the dimension of matrix Ai....
Let {dn}n≥0 denote the number of integer solutions a1 +a2 +a3 +a4 = n where 0 ≤ ai ≤ 5 for each i = 1, 2, 3, 4. Write the ordinary generating function for {cn}n≥0. Please express the ordinary generating function as a rational function p(x) /q(x) where both p(x) and q(x) are polynomials in the variable x.
(1) Let a (.. ,a-2, a-1,ao, a1, a2,...) be a sequence of real numbers so that f(n) an. (We may equivalently write a = (abez) Consider the homogeneous linear recurrence p(A)/(n) = (A2-A-1)/(n) = 0. (a) Show ak-2-ak-ak-1 for all k z. (b) When we let ao 0 and a 1 we arrive at our usual Fibonacci numbers, f However, given the result from (a) we many consider f-k where k0. Using the Principle of Strong Mathematical Induction slow j-,-(-1...