a. Correctness of dynamic programming algorithm:
Usually, a dynamic programming algorithm can be seen as a recursion and proof by induction is one of the easiest way to show its correctness. The structure of a proof by strong induction for one variable, say n, contains three parts. First, we define the Proposition P(n) that we want to prove for the variable n. Next, we show that the proposition holds for Base case(s), such as n = 0, 1, . . . etc. Finally, in the Inductive step, we assume that P(n) holds for any value of n strictly smaller than n' , then we prove that P(n') also holds.
Use the proof by strong induction properly to show that the algorithm of the Knapsack problem above is correct.
b. Bounded Knapsack Problem:
Let us consider a similar problem, in which each item i has ci > 0 copies (ci is an integer). Thus, xi is no longer a binary value, but a non-negative integer at most equal to ci , 0 ≤ xi ≤ ci . Modify the dynamic programming algorithm seen at class for this problem.
Note: One could consider a new set, in which item i has ci occurrences. Then, the algorithm seen as class can be applied. However, this could be costly since ci might be large. Therefore, the algorithm you propose should be different than this one.
c. Unbounded Knapsack Problem:
In this question, we consider the case where the quantity of each item is unlimited. Thus, xi could be any non-negative integer. Provide a dynamic programming algorithm for this problem.


Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

- Give a recursive definition of the relation is equal to on N x N using the operator s.arrow_forwardQ2 – Proof of Correctness In this question, you will use strong induction to prove that your new algorithm works correctly. In other words, you will prove that nN xR-{0} FP(x,n) = xn a) Predicate Function Your conjecture has already been stated in symbolic form: It is a statement of the form nN, P(n) What is the predicate function P(n)? b) Proof: Base cases c) Proof: Inductive step setup This is the beginning of the inductive step where you are stating the assumptions in the inductive step and what you will be proving in that step. As you do so, identify the inductive hypothesis. d) proof: inductive stepsarrow_forwardQuestion 3 Full explain this question and text typing work only thanks..arrow_forward
- Discrete MathQ: ) Prove the distributive laws (DL1) DL1 set photo have been uploaded belowarrow_forward1. Big-O Notation Let f and g be functions from the set of integers or the set of real numbers to the set of real numbers. We say that f ( x ) is O ( g ( x ) ), read as "f ( x ) is big-oh of g ( x )", if there are constants C and k such that | f ( x ) | ≤ C | g ( x ) | whenever x > k. (a) Show that f(x) = x2 + 2x + 1 is O(x2) Solution: When x>1; ? 2 (1 + 2 ? + 1 ? 2 ) < ? 2 (1 + 2 1 + 1 1 2 ) = 4? 2 So, ??? ? > 1, ? 2 + 2? + 1 < 4? 2 From the definition 0 ≤ f(x) ≤ cg(x) for x≥1 Hence, for N0 = 1; c=4; and g(x)=x2 for N0 = 2; c=3; and g(x)=x2 for N0 = 3; c=2; and g(x)=x2 … Therefore, ? ? + ?? + ? = ?(? ? ) O(g(x)) = {f(x)|there exist positive constant c and N0 such that 0 ≤ f(x) ≤ cg(x) for all x≥N0} 2. Show that 7x2 is O(x3). 3. Suppose there are x number of boxes to be delivered to x number of household that is 2km apart, what is the distance travelled by the transport delivery service? 4. In number 3, suppose that each boxes…arrow_forwardProve each statement by contrapositivearrow_forward
- Boolean Satisfaction Problem Boolean Satisfiability Problem (SAT) (https://en.wikipedia.org/wiki/Boolean_satisfiability_problem) is one of the most important problems in Computer Science. SAT is a problem that has NP-Complete complexity, where the only way to solve the problem is to try all the possibilities and check which one is correct. [LO 1, LO 2, LO 3 & LO 4,] Briefly describe how you used Backtracking to solve the Boolean Satisfiability Problem. Note that your solution must have exponential complexity. [LO 1, LO 2, LO 3 & LO 4,] Briefly explain how you use Strongly Connected Component (SCC) to solve the special case of the Boolean Satisfiability Problem, namely 2-SAT (https://en.wikipedia. org/wiki/2-SAT) . This solution has linear complexity. Solve the Subparts A&B thank u NOTE LO1: Explain fundamental concept of analysis arithms. LO2: Apply algorithm techniques and methods. LO3: Solve a problem using specific algorithm. LO4: Compare several algorithm design…arrow_forwardDifferentiate between Recursion and Iteration and when to use them. (b) Give two (2) examples of problems that can be solved using Recursion.arrow_forwardA. Construct a RECURSIVE solution for following iterative solution to find a value in a circular-linked list B. Analyze the runtime complexity (correctly explain the scenario, show how much work would be done, and represent the work using asymptotic notations, i.e. big O), of the given iterative solution and your recursive solution for the best case scenario and the worse case scenario. C. prove the correctness of your recursive solution by induction /**@param value - a value to search for@return true if the value is in the list and set the current reference to itotherwise return false and not updating the current reference*/public boolean find(T value){ if(this.cur == null) return false; //get out, nothing is in here Node<T> tmp = this.cur; //start at the current position if(tmp.data == value) return true; // found it at the starting location tmp = tmp.next; //adv. to next node, if there is one while(tmp != cur) { if(tmp.data == value){ this.cur = tmp;…arrow_forward
- To guess a closed-form of polynomial for a recurrence sequence, difference sequence between terms can be checked. If the difference sequence is a constant, what kind of the closed-form is it likely to be? O constant O linear function O quadratic function O higher order polynomialarrow_forwardLet ƒ : Z → Z be some function over the integers. Select an appro- priate proof technique (direct, contradiction, induction, invariant or pigeonhole), and prove that if you have: a, f(a), ƒ(f(a)), ƒ(f(f(a))) and f(f(f(f(@)))), then at least 2 of those numbers are equivalent modulo 4.arrow_forwardGive a recursive definition for the set of all strings of a’s and b’s that begins with an a and ends in a b. Say, S = { ab, aab, abb, aaab, aabb, abbb, abab..} Let S be the set of all strings of a’s and b’s that begins with a and ends in a b. The recursive definition is as follows – Base:... Recursion: If u ∈ S, then... Restriction: There are no elements of S other than those obtained from the base and recursion of S.arrow_forward