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. 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Information Systems (IS) play a critical role in supporting, supplementing

  Information Systems (IS) play a critical role in supporting, supplementing and automating many of our professional and personal lives, including business decision-making, shaping and transforming industries, and contributing to deep societal and economic change.  The impact of technology on economic growth and development, electronic globalization, and the vast opportunities

A Study of Lean Management and Lead-Time.

Assessment Task LEAN MANAGEMENT is recognised as a means of delivering VALUE to the CUSTOMER. The purpose of this assignment is to enable you to demonstrate an understanding of LEAN MANAGEMENT and the practical concepts within it. LEAD TIME is defined as the time between placing an order for a

Maria has been angry with Carlos for a very long

Maria has been angry with Carlos for a very long time. She had threatened to kill Carlos on a couple of occasions. One day, Maria sees Carlos standing on a street corner waiting to cross the street. There are several people standing around Carlos, also waiting to cross. Maria pulls

Health Belief Model

The Health Belief Model Students will discuss the following content (minimum of 4 and maximum of 6 pages excluding title page and references): 1. Discuss the concepts and sub concepts of the theory with clarity and simplicity. 2. Describe the generality of the theory and how it is applied broadly

Context On September 13, 2021, Senator Elizabeth Warren sent FED

    Context On September 13, 2021, Senator Elizabeth Warren sent FED Chair Jerome Powell a letter https://www.warren.senate.gov/imo/media/doc/Letter%20from%20Senator%20Warren%20to%20Fed%20on%20Wells%20Fargo%20FHC%20Status%2009.13.2021.pdf In the letter she wrote “Under Janet Yellen’s leadership, the Fed  placed Wells Fargo under an asset cap in 2018 due to its ‘widespread  consumer abuses and other compliance breakdowns.  In the three years

With your groups, create a SKIT to resolve the conflict

   With your groups, create a SKIT to resolve the conflict using the concepts and theories in our book: 1. Could this problem have been avoided by Abdul? How? 2. What is your solution to this problem?  What needs to be done to get the department running smoothly again? 3.

HEALTH PROMOTION STRATEGIES AND RESOURCE

Description https://www.youtube.com/watch?v=ERInZote0EE [VIDEO] http://www.youtube.com/watch?v=nVWsBVoSGdo [VIDEO] http://www.youtube.com/watch?v=Cyx3rk05lJ4 [VIDEO] http://www.youtube.com/watch?v=XaL-YiZsh0M&feature=fvwrel [VIDEO] http://www.youtube.com/watch?v=bLaTPplQOWY Please watch at least two of the brief videos linked in the background info. Write an essay that includes the following: Tell me which 2 videos you watched. Briefly explain the main themes of each video. What health issues and

Memory Span (Lab Report) – Premium Paper Help

Premium Paper Help is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.

Write a fully developed paper in which you: Select one

 Write a fully developed paper in which you:  Select one of the working groups in the IETF or IEEE and briefly summarize what this group is working on. Justify the need of the IEEE 802 standard used in networking. Evaluate the three standard organizations including IEEE, ISO, and  ANSI to

Watch one episode of the Inner Fish series (Your Inner

Watch one episode of the Inner Fish series (Your Inner Fish, Your Inner Reptile, or Your Inner Monkey). Write a 2-page summary and critique of it (you can focus on one specific part), including at least one scholarly source not in the syllabus to support your argument. Find a current

Many people today believe that U.S. executives are paid too

 Many people today believe that U.S. executives are paid too much while others believe that the size of their compensation packages are justified. For this assignment, choose a peer-reviewed article to review. Use the databases in the CSU Online Library, and find an article about executive compensation that is of

Business Case A car-sharing company decided to use a MongoDB

   Business Case A car-sharing company decided to use a MongoDB NoSQL database to store information about their primary operations, which include recording of all rides, real-time car locations, and users. A ride is defined as a combination of pick-up location, and drop-off locations (if the car has been returned),

Because this is a pamphlet/brochure type assignment, you can choose

  Because this is a pamphlet/brochure type assignment, you can choose any font size and type you like. You can submit the assignment as a word, publisher or PDF document.  You have been asked to develop a pamphlet for expecting mothers. The pamphlet would tell mothers-to-be about: the importance of prenatal

Week 4 – Assignment: Analyze a Case Study of a

  Week 4 – Assignment: Analyze a Case Study of a Nonprofit Leader’s Actions Previous Next  Instructions Imagine that you are a board member of a small nonprofit organization in Chicago. One day, you read in the newspaper about the executive director of the organization being investigated for possibly improperly