# 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

### Assignment Content The purpose of this assignment is to align

Assignment Content The purpose of this assignment is to align proper service system applications to certain industries. You will also analyze and evaluate a

### 1. What are three questions you should ask yourself when you begin you

1. What are three questions you should ask yourself when you begin your job search? 2. What are the most common mistakes people make in

### This assignment requires you to write a Literature Review draft

This assignment requires you to write a Literature Review draft based on the credible academic sources you have read and evaluated about your topic.  The

Instructions You have read about employee development in the organizational setting. As part of your training, you are required to give a PowerPoint presentation

### Over the next five weeks, you will research and analyze

Over the next five weeks, you will research and analyze financial information on two companies listed on an exchange. Choose any two companies that are

### Present two different types of data, or variables, used in

Present two different types of data, or variables, used in the health field. Examples could be blood pressure, temperature, pH, pain rating scales, pulse

### 250 words+ Topics: 1. You already study database for a

250 words+ Topics: 1. You already study database for a Spring term. So based on your study, can you design a new database system with

### Submit two files. Submit the persuasive speech preparation outline in

Submit two files. Submit the persuasive speech preparation outline in Microsoft Word using the SPCH275 Speech Preparation Outline Template with a References list in APA

### Using your textbook, LIRN, other researchable databases, and the Internet,

Using your textbook, LIRN, other researchable databases, and the Internet, develop an APA formatted paper. Your paper must include in-text citations, references, critical thinking, creativity

### Strategic Crisis Management – Literature Review

For this assignment students must read and review one of the scholarly journal articles selected and posted on the course site. There will only be

### this assignment is due tomorrow Child education assignment All of

this assignment is due tomorrow  Child education assignment  All of the instructions are in the 1st attachment  Do all the 3 task sections in the

### help with a 350- to 400-word draft of identify the

help with a 350- to 400-word draft of identify the nature of the developmental stage of adolescence (12-19)    headings Social Media Usage for

New questions