Your Perfect Assignment is Just a Click Away
We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!


Algorithms Coding Assignment.(4 Problems- 2 Theory And 2 Coding Questions)

Algorithms Coding Assignment.(4 Problems- 2 Theory And 2 Coding Questions)

Algorithms Coding Assignment.(4 Problems- 2 Theory And 2 Coding Questions)

 Problem 1: Knapsack Variant  (Pseudocode)
Consider the following version of Knapsack. Given are two weight limits W1 and W2, where W1 ≤ W2. Given are also n items (w1, c1),(w2, c2), . . . ,(wn, cn), where wi is the weight and ci the cost of the i-th item. We want to find a subset of these items of the highest cost, where the subset weights at least W1 and at most W2. Give an O(nW2) algorithm for this problem. (Re Block Crusher (Kattis) call that the cost (respectively weight) of a subset is the sum of the costs (respectively weights) of the items in the subset.)

Problem 2: Minimum Spanning Tree with Repeated Costs (Proof)
Consider the Minimum Cost Spanning Tree problem on an undirected graph G = (V, E) with a cost ce ≥ 0 on each edge, where the costs may not all be different. If the costs are not all distinct, there can in general be many distinct minimum-cost solutions. Suppose we are given a spanning tree T ⊆ E with the guarantee that, for every e ∈ T, e belongs to some minimum-cost spanning tree in G. Can we conclude that T itself must be a minimum-cost spanning tree in G? Give a proof or counterexample with explanation.

Problem 3: Block Crusher (Kattis)
Solve the “Block Crusher”, which you can find at this web address: https://open.kattis. com/problems/blockcrusher This is a coding problem; be sure to follow the relevant instructions for testing and submitting.

Problem 4:  Continuous Median (Kattis)
Solve the “Continuous Median” problem, which you can find at this web address: https: // This is a coding problem; be sure to follow the relevant instructions for testing and submitting. An O(n 2 ) algorithm will not be fast enough to pass all the tests, and will receive at most 3 points out of 10. You need to get the running time down to o(n 2 ), and ideally, O(n log n).
Hint 1: Suppose “median” in the problem statement were replaced by “min” (or “max”). How would you solve that problem? Suppose we added the additional condition that, after even-numbered inputs, you must return the min value, and thereafter treat it as having been deleted from the data set. How would you solve it now?
Hint 2: Notice that the median element is (ignoring rounding for now) the maximum element of the bottom half of the input, and the minimum element of the top half of the input. How can you make use of that fact?
Hint 3: Choosing the right data structure is essential.

We offer the best custom essay writing services at an affordable rate. We have done this assignment before, we can also do it for you.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Essay Pillars only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Essay Pillars are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Essay Pillars is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Essay Pillars, we have put in place a team of experts who answer to all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.