Computers and Technology

Suppose you are packing for a backpacking trip and trying to decide which snacks to bring. your home pantry contains m snack items, each of which has a certain weight wi and a calorie value vi. your backpack can only hold a maximum weight of w , and for your journey you need a minimum of v calories. therefore, you need to answer the question: is there is some set s of items from your pantry such that the sum of the weights of the items in s is less than or equal to w , while the sum of the calorie values of the items in s is greater than or equal to v. required:
a. describe a (deterministic) algorithm for answering the question. is it a polynomial-time algorithm? explain your answer.
b. describe a non-deterministic algorithm for deciding the question. is it a nondeterministic polynomial-time algorithm?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 19:00, devila321
When keyboarding, if you want to be fast and accurate you should return your hands on home row with your fingers relaxed and your eyes on the text use only your index fingers to hunt and peck keep your fingers stiff and your eyes on the keys slouch in your chair and keep your fingers hovering over all of the keys
Answers: 2
image
Computers and Technology, 22.06.2019 20:40, wutdmgamerz
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
image
Computers and Technology, 23.06.2019 04:00, ittmanny6138
Laire writes a letter to her grandmother, in which she describes an amusement park she visited last week. she adds pictures of that place in her letter. which feature of a word processing program will claire to remove unwanted parts of the pictures?
Answers: 3
image
Computers and Technology, 23.06.2019 14:00, camiserjai1832
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
Do you know the correct answer?
Suppose you are packing for a backpacking trip and trying to decide which snacks to bring. your home...

Questions in other subjects: