7. Binomial Coefficients. 15 marks; 5 marks each You may recall that the binomia
ID: 3682538 • Letter: 7
Question
7. Binomial Coefficients. 15 marks; 5 marks each You may recall that the binomial coefficient, denoted C(n, k) or is the number of combinations (subsets) of k elements from an n-element set (0 S k S n). The name "binomial coefficients" comes from the participation of these numbers in the binomial formula: m, n Of the numerous properties of binomial coefficients, we focus on two: C(n, k) O(n 1, 1) C(n 1, k) for n k 0, for all integers n -0 C n, 0) C(n,n) 1 for all integers n 0 (a) Give pseudocode for a dynamic programming algorithm to compute C n, k) that uses only addi- tions. [5 marks (b) What is the time and space efficiency of your algorithm? 5 marks (c) Find the exact number of additions made by your algorithm, i.e set up an expression A(n, k) counting the total number of additions made by your algorithm in computing C(n, k) and solve it exactly. 15 marksExplanation / Answer
a)
Algorithm Dynamic_Prog(d):
for each start from 1 to n, do:
for each t from 1 to n, do:
Let p[start, t]^(0) be d(s, t).
end
end
for each k from 1 to n, do:
for each s from 1 to n, do:
for each t from 1 to n, do:
Let p[s, t]^(k) be min { p[s, t]^(k - 1), p[s, k]^(k - 1) + p[k, t]^(k - 1) }.
end
end
end
return p^(n).
b) Time effieciency of dynamic programming algorithm:
O(n)
Space complexity:
Omega(n)
c)For this it takes exactly it takes n additions.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.