Please help with question 2 (c).
(2) Suppose, the game is updated so that every item, i, now has weight, wi], in kilograms (you ca...
There are n items in a store. For each item i=1,2,...,n the weight of the item is wi and the value of the item is vi. A thief is carrying a knapsack of weight W. In this version of a problem the items can be broken into smaller pieces, so the thief may decide to carry only a fraction xi of object i, where 0≤xi ≤1. Item i contributes xiwi to the total weight in the knapsack, and xivi to...
Please explain step by step, thank you so much! 0-1 Knapsack (N=6, W=10) Item Weight Value (lb) ($) 8 1 0 10 Weight limit w(lb) 4 5 6 7 2 2 2 2 2 2 3 2 #2 2 1 2 43 33 3 w #3 0 2 3 3 #4 56 w 2 a #6 7. (10%) (Cont.) Unbounded Knapsack Problem (1-Dim Dynamic Programming) Weight limit w 0 : 6 Weight limit w F(w) 7 Unbounded Knapsack (N=6, W=10)...
2. In the BACKPACK problem, you are given a collection of books of different costs and are tasked with storing as expensive a subset of books as possible so you can sell them at the bookstore in only one trip. Unfortunately, the books are very heavy, and you are limited in how much total weight you can carry. Formally, you are given two arrays C[1.. n] and w[1..n] of positive integers where C[i] is the cost of book i in...
please I would like assistance with this which are question 1 and 2, thank you 2. We have 5 objects, and the weights and values are No. 2 3 4 5 10 20 30 50 V 20 30 66 60 55 W 40 The knapsack can carry a weight not exceeding 90, find a subset items and give the total weight and value for following algorithms: 1) By using the algorithm of greedy of value for 0-1 knapsack problem? By...
2 Knapsack Problem In a Knapsack problem, given n items {11, I2, -.., In} with weight {wi, w2, -.., wn) and value fvi, v2, ..., vn], the goal is to select a combination of items such that the total value V is maximized and the total weight is less or equal to a given capacity W. Tt i=1 In this question, we will consider two different ways to represent a solution to the Knapsack problem using an array with size...
PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...
DESCRIPTION You have to design an e-commerce shopping cart. These require classes Item, Electronics, Food, Dress, Cart and Main. ITEM CLASS Your Item class should contain: Attributes (protected) String name - name of the Item double price - price of the item Methods (public) void setName(String n) - sets the name of Item void setPrice(double p) - sets the price of Item String getName() - retrieves name double getPrice() - retrieves price String formattedOutput() returns a string containing detail of...
Question 2: Finding the best Scrabble word with Recursion using java Scrabble is a game in which players construct words from random letters, building on words already played. Each letter has an associated point value and the aim is to collect more points than your opponent. Please see https: //en.wikipedia.org/wiki/Scrabble for an overview if you are unfamiliar with the game. You will write a program that allows a user to enter 7 letters (representing the letter tiles they hold), plus...