Knapsack Problem This exercise is due Tuesday, May 14. It has to be turned in on time in order to get participation credit. I'll come into class and go over the solution right away. Then I will collect your work on the exercise. Be ready to turn it in at that time . Fill out the table for the knapsack problem, where the objects weights, and values are as given and the overall weight limit is 10 Next, circle the entries in the table that are used when backtracking to find objects to use in the solution. Then list the object numbers that can be used for an optimal solution. Also list the weights and values of those objects Verify that the values of your solution objects add up to the optimal number in the last row and column in the table Verify that the sum of the weights of your solution the objects is not more than the overall weight limit of 10 Weight Capacity - wt val 1 2 3 4 5 6 789 10 Here is a filled-out table for a similar problem: Total Weight -- #wtval 1 0 1 2 3 4 5 6 0 2 2 2 2 2 2 2 0 2 3 7 9 11 12 16 Let me know in class if you have questions about how such problems are solved. The algorithm is covered in section 6.4

Question

Knapsack Problem


This exercise is due Tuesday, May 14. It has to be turned in on time in order to get participation credit. I'll come into class and go over the solution right away. Then I will collect your work on the exercise. Be ready to turn it in at that time.

  • Fill out the table for the knapsack problem, where the objects, weights, and values are as given, and the overall weight limit is 10. 
  • Next, circle the entries in the table that are used when backtracking to find objects to use in the solution. 
  • Then list the object numbers that can be used for an optimal solution. 
  • Also list the weights and values of those objects. 
  • Verify that the values of your solution objects add up to the optimal number in the last row and column in the table. 
  • Verify that the sum of the weights of your solution the objects is not more than the overall weight limit of 10.

                            Weight Capacity ----->

obj

 #  wt val   |  0   1   2   3   4   5   6   7   8   9  10

_________________________________________________________

 0  0   0   |   0   0   0   0   0   0   0   0   0   0   0

 1  4   5   |   0  

 2  3   4   |   0  

 3  5   7   |   0  

 4  3   2   |   0



Here is a filled-out table for a similar problem:

                   Total Weight ----->

obj

 #  wt val   |  0   1   2   3   4   5   6   7

_____________________________________________

 0  0   0   |   0   0   0   0   0   0   0   0

 1  1   2   |   0   2   2   2   2   2   2   2

 2  4   9   |   0   2   2   2   9  11  11  11

 3  3   7   |   0   2   2   7   9  11  11  16

 4  2   3   |   0   2   3   7   9  11  12  16

Let me know in class if you have questions about how such problems are solved. The algorithm is covered in section 6.4. 

Knapsack Problem
This exercise is due Tuesday, May 14. It has to be turned in on time in order to get participation credit. I'll come into class and go over the solution right away. Then I will collect your work on
the exercise. Be ready to turn it in at that time
. Fill out the table for the knapsack problem, where the objects weights, and values are as given and the overall weight limit is 10
Next, circle the entries in the table that are used when backtracking to find objects to use in the solution.
Then list the object numbers that can be used for an optimal solution.
Also list the weights and values of those objects
Verify that the values of your solution objects add up to the optimal number in the last row and column in the table
Verify that the sum of the weights of your solution the objects is not more than the overall weight limit of 10
Weight Capacity -
wt val
1 2 3 4 5 6 789 10
Here is a filled-out table for a similar problem:
Total Weight --
#wtval 1 0 1 2 3 4 5 6
0 2 2 2 2 2 2 2
0 2 3 7 9 11 12 16
Let me know in class if you have questions about how such problems are solved. The algorithm is covered in section 6.4
Expand
Transcribed Image Text

Knapsack Problem This exercise is due Tuesday, May 14. It has to be turned in on time in order to get participation credit. I'll come into class and go over the solution right away. Then I will collect your work on the exercise. Be ready to turn it in at that time . Fill out the table for the knapsack problem, where the objects weights, and values are as given and the overall weight limit is 10 Next, circle the entries in the table that are used when backtracking to find objects to use in the solution. Then list the object numbers that can be used for an optimal solution. Also list the weights and values of those objects Verify that the values of your solution objects add up to the optimal number in the last row and column in the table Verify that the sum of the weights of your solution the objects is not more than the overall weight limit of 10 Weight Capacity - wt val 1 2 3 4 5 6 789 10 Here is a filled-out table for a similar problem: Total Weight -- #wtval 1 0 1 2 3 4 5 6 0 2 2 2 2 2 2 2 0 2 3 7 9 11 12 16 Let me know in class if you have questions about how such problems are solved. The algorithm is covered in section 6.4

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: How do you convert 172.16.20.55 to binary format?

A: 172.16.20.55 represents IP address in decimal format. In order to convert it into binary format we n...

Q: How do I check if a binary number is a multiple of 16 by using bit shifting?

A: Approach: Result = (((n >>4) << 4) == n). First we shift the 4 bit right then we shift t...

Q: 2. Write a program called ListOddNumbers that prints the below (there is a single space between each...

A: Solution: 2. The below program is written in Java language to display the odd number between 1 and 5...

Q: Write a program called Convert, which converts an ASCII code to its equivalentcharacter. 1) Create a...

A: Java codeimport java.util.Scanner; public class Convert{public static void main(String[] args) {Scan...

Q: Programming in C language.

A: Note:The below program has been complied and run in "repl.it" online complier.

Q: what is the best test strategy for any ERP system?

A: ERP stands for Enterprise resource planning is a software used for business process management. It a...

Q: Associate each of the following concepts with one of the languages we covered (pseudo code,FORTRAN, ...

A: Associating languages with given concepts:ALGOL 60: Pass by nameALGOL 60: Pass by valueFORTRAN: Assi...

Q: import java.util.*;public class TestAverage {public static void main(String[] args) {int test1, test...

A: Click to see the answer

Q: A Maze Room : In this lab, we will make a maze game. The maze is based on Linked Lists. Instead of h...

A: For class Room, implement the setter and getter methods by assign and returning values respectively....

Q: Eliminate useless productions from S → a |aA| B|C, A → aB|λ, B → Aa, C → cCD, D → ddd|Cd.

A: Identifying non-generating variables:

Q: Develop the ‘Shape’ application such that: ‘Rectangle’, ‘Ellipse’, and ‘Triangle’ classes inherit f...

A: Program plan:Define a class named “Shape”.Define a default constructor to print constructor invoked ...

Q: Design a payroll program that prompts user enter an employee's hourly pay rate and the number of hou...

A: Since nothing is mentioned about the programming language to be used, Java has been used as it is on...

Q: what is the most cheapest firewall

A: Firewalls provide security to the network by monitoring and controlling the network traffic. It crea...

Q: For the following problem please write an algorithm in plain English .i.e give details as to how you...

A: Algorithm to arrange the deck of 52 cards for the given scenario is as follows:  

Q: Write a class, AgeMessages , which does the following:a. Ask the user to enter age using a Scannerb....

A: //Import required packagesimport java.util.Scanner; //Definition of class "AgeMessage"public class A...

Q: Consider the Sort-and-Count algorithm explained in section 5.3 of our text: "Counting Inversions"Sup...

A: Given:Initial list:26   81   87   32   66   72   86   97   23   48   14   71   89   18   49   62Algo...

Q: Attached Files:  sample.txt (11.069 KB) You will only get one submission. I need a python prog...

A: Three counters are used to keep track of the running count of the words being read from the supplied...

Q: Develop the ‘Shape’ application such that: Implement an array of objects of various types (all SIX ...

A: Program plan:Define a class called “ShapeTest”.Define a “main()” method.Create an array of six shape...

Q: Construct npda that accept the following languages on Σ = {a, b, c}: L = {wcwR : w ∈ {a, b}∗}.

A: Non-deterministic pushdown automaton (NPDA):Given: L = {wcwR : w ∈ {a, b}∗}To construct NPDA, when “...

Q: Design a program that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit...

A: Program plan:Use “for” loop to print a table of the Celsius temperatures 0 through 20 and their Fahr...

Q: you can allocate up to how many primary partitions on a hard drive

A: A hard drive usually comprises of primary partitions and logical partitions. Primary partition conta...

Q: How do I get this flat list table into 1NF, 2NF and 3NF?

A: Normalization:Normalization is a process of dividing the tables by more than one idea into set of ta...

Q: Assume that a firm has already implemented a KMS system, as a manager, how do you ensure that learni...

A: Protecting knowledge of the organization is a typically an IP protection problem.The ways the organi...

Q: How do I read a sequence of values in a file into a arraylist in a method? It's in java progarmming.

A: We need to use Scanner calss. In which java.util package used for obtaining the input of the primiti...

Q: Consider the following procedure: procedure mystery (x, y, z); integer x, y, z;beginz =2; y = z + x;...

A: Call by reference The arguments passed to a function will copy the address of an argument into the f...

Q: 2. What happens when you give the following commands if the file named done already exists?$ cp to_d...

A: The given two commands cp and mv are used in Linux and Unix. These commands are used for copying and...

Q: 5-13) Find the largest n such that n cubed is less than a positive integer entered by the user. Use ...

A: The heart of the algorithm lies in finding such a number whose cube is less than the given number he...

Q: health informatics

A:  I think the student wants to know what health informatics is, so we will be providing a brief intro...

Q: how can I write a statement in C++ that would print last name, followed by a comma, followed by firs...

A: Given below is the C++ program to print a statement with last name, followed by comma, followed by f...

Q: Function #2: largest Parameters: num1 - a floating point number being compared against num2 and num3...

A: Solution:largest() function:#Define the functiondef largest(num1, num2, num3):    #Check if "num1" i...

Q: How can I check if a binary number is an even number. So, the binary has a 0 remainder when divided ...

A: Approach: Result = (((n >> 1) << 1) == n). First we shift the 1 bit right then we shift ...

Q: Problem: Create a base class called Vehicle that has the manufacturer’s name (typeString), number of...

A: Program plan:Create a class called “Person” with required constructors and methods.Create a class ca...

Q: Programming in C.

A: Algorithm: Declare required header files.Create “ContactInfo” structure.Declare required variables f...

Q: Can someone offer an explanation to these few simple questions please?

A: Click to see the answer

Q: I need help with the SQL query for the following question: 1.  Get the total number of reviews of mo...

A: The details about the table are given with table name and different entities. Here the table name is...

Q: Which filenames would be a subsequent ls command display?$ lsabc abd abe abf abg abh$ rm abc ab*rm: ...

A: To describe which filenames the subsequent ls command display.

Q: I am struggling on storing numbers from the getChoice () function into an array and pulling it back ...

A: Click to see the answer

Q: Thank you!C++ please

A: First we'll create a LinkedList class.Below is the code for the LinkedList class:-class LinkedList{p...

Q: create a new file in c++. In this lab, you will add some more functionality to the program. Use loop...

A: Program Instructions:Declare variables and write a welcome message.Always convert the user's choice ...

Q: I am trying to get the range of bits from a number. For example , if I call bitRange(0x00001234, 0 ,...

A: Step 1: To extract the bits from the hexadecimal number we need to use the shift operator and use bi...

Q: // java // book is starting out with java //chapter 12  (5)Theater RevenueA movie theater only keeps...

A: Program plan:Import required packages.Define a class named “TheatreGUI”.Declare the required variabl...

Q: I am trying ro create this java program , i have the table in my tatabase . I am using postgresql ii...

A: Program Instructions:Add the postgresql jar file in your project library.Create a database and a tab...

Q: Create a new file in C++ and save it as lab12_XYZ.cpp  Consider rolling two six-sided dice. Whil...

A: Program Instructions:Declare the header files, constants, and prototypes.In main() call functions di...

Q: I need help with creating a main.css, I already have the HTML.the details are in the pic and I will ...

A: CSS codebody{font-family: Sans-serif;/*set the font to Sans serif*/} a {color: maroon;/*set links to...

Q: What language is accepted by the npda M = ({q0, q1, q2}, {a, b}, {a, b, z}} q0, z, {q2}). δ(q0,a,z)=...

A: The given npda is M = ({q0, q1, q2}, {a, b}, {a, b, z}} q0, z, {q2}) with transition functions asδ(q...

Q: Load “Lock5Data” into your R console. Load “OlympicMarathon” data set in“Lock5Data”. This data set c...

A: First we install the Lock5Data package and then load the package. Then we load the library dplyr to ...

Q: **accounting information system**1. HTML and XML- how are they similar? how are these different? XML...

A: We will answer the first question since the exact one is not specified. Please submit a new question...

Q: Load “Lock5Data” into your R console. Load “OlympicMarathon” data set in“Lock5Data”. This data set c...

A: First we install the Lock5Data package and then load the package. Then we load the library dplyr to ...

Q: Function Name: leapYear Parameters: year – an nonnegative integer representing the year Test Cases: ...

A: Click to see the answer

Q: 11.7: Customer AccountsWrite a program that uses a structure to store the following data about a cus...

A: Program plan:Include the required header files.Define the structure “customerAccount”Declare the req...