subject

Athief is given the choice ofnobjects to steal, but only has one knapsack with a capacity of takingmweight. each objectihas weightwi, and profitpi.(a) first, suppose that the objects are divisible (e. g., the thief is in a cheese shop and the itemsare rolls of cheese that can be cut). for each objecti, if a fractionxi, 0≤xi≤1 (takingxi= 1 would be taking the entire object) is placed in the knapsack, then the profit earnedispixi. come up with an efficient greedy algorithm for maximizing the profit of the thief. prove the correctness and running time.(b) now, suppose the items cannot be taken fractionally. in other words, the thief can eithertake an entire item or leave it behind. suppose we also know the following: the order of theseitems when sorted by increasing weight is the same as their order when sorted by decreasingvalue. give a greedy algorithm to find an optimal solution to this variant of the knapsackproblem. prove the correctness and running time.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:20
Geneva’s manager would like to see some additional information to make sales decisions.enter a formula in cell j4 using the if function to it whether or not the item beaded earrings should go on sale. it will go on sale if its current sales rank (in cell g4) is 8th or lower. (hint: if the cell value is greater than or equal to 8, it will go on sale.)if this condition is true, the item will go on sale. (hint: the if_true value should be “yes”.)if this condition is false, the item doesn’t need to go on sale. (hint: the if_false value should be “-”.)copy the formula created in cell j4 to the range j5: j14
Answers: 2
question
Computers and Technology, 22.06.2019 09:50
Assume that you have an sorted array of records. assume that the length of the array (n) is known. give two different methods to search for a specific value in this array. you can use english or pseudo-code for your algorithm. what is the time complexity for each algorithm and why?
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 23.06.2019 06:30
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
You know the right answer?
Athief is given the choice ofnobjects to steal, but only has one knapsack with a capacity of takingm...
Questions
question
Social Studies, 07.05.2020 05:00
question
English, 07.05.2020 05:00
question
Mathematics, 07.05.2020 05:00
Questions on the website: 13722363