# Problem 1: Knapsack Variant (Pseudocode) Consider the following version of

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: //open.kattis.com/problems/continuousmedian 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.

Pages (275 words)
Standard price: \$0.00

### Latest Reviews

Impressed with the sample above? Wait there is more

Related Questions

### The purpose of this assignment is to examine essential leadership

The purpose of this assignment is to examine essential leadership competencies to demonstrate leadership as a vocation, as well as successfully lead in an organization.

### Read- While not all nurses will conduct research studies, every

Read-  While not all nurses will conduct research studies, every nurse will be required to implement evidence-based practice (EBP). Evidence-based practice is an integral approach

### DIRECTIONS I expect at the minimum, one complete paragraph for

DIRECTIONS I expect at the minimum, one complete paragraph for each question or part of the question. You will be graded based on the thoroughness

### How is gender race or ethnicity instrumental to our construction of beauty How is gender race or ethnicity instrumental to

How is gender, race or ethnicity instrumental to our construction of beauty?How is gender, race or ethnicity instrumental to our construction of norms in society,

### Please write an article on the topic below using the

Please write an article on the topic below using the following guidelines-using 300 words APA format with at least two references. Sources must be

### Discuss the impact on how health policy and politics influence healthcare and nursing practice.

Description Discuss the impact on how health policy and politics influence healthcare and nursing practice. define health policy and politics, discuss current health policy that

### Test Developer From all the test developer profiles available on

Test Developer  From all the test developer profiles available on the world wide web (WWW), identify one developer of a values test that interests you.

### Reflection Entry 6-Cover the following briefly within one page in

Reflection Entry 6-Cover the following briefly within one page in your own words: Discuss how a business intelligence consultant can lead and manage change, handle

### Assignment 2: Intervention Treatment Plan According to the Council on

Assignment 2: Intervention Treatment Plan According to the Council on Social Work Education, Competency 4: Engage In Practice-informed Research and Research-informed Practice: Social workers understand

### Module 2 is all about the Value of Relationships. It

Module 2 is all about the Value of Relationships. It focuses on how we can actually measure or quantify the value that a customer has

### I NEED TWO DIFFERENT COPIES OF THIS AND THE FORMAT

I NEED TWO DIFFERENT COPIES OF THIS AND THE FORMAT IS JUST HOW IT TELLS THERE: ONLY ERASING THE ITALICS AND THATS IT, WITHOUT APA

### Affordable and Accessible Education Not all of us are rich

Affordable and Accessible Education Not all of us are rich and have money in our banks. But should this be a factor in deciding

New questions