Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
Book Icon
Chapter 16.1, Problem 5E
Program Plan Intro

To modify the Activity-Selection problem in such a way that the total value of activities scheduled is maximized, that is, akAvk is maximized.

Blurred answer
Students have asked these similar questions
Question 2: Consider the 0/1 knapsack problem. Given Nobjects where each object is specified by a weight and a profit, you are to put the objects in a bag of capacity C such that the sum of weights of the items in the bag does not exceed Cand the profits of the items is maximized. Note that you cannot use an item type more than once. a. Using dynamic programming, write an algorithm that finds the maximum total value according to the above constraints. b. What is the complexity of your algorithm? c. Show the dynamic programming table for the following data: W= { 2 ,7 , 1} , P={ 3 ,15 , 2 } and C=8.
There are n people who want to carpool during m days. On day i, some subset ???? of people want to carpool, and the driver di must be selected from si . Each person j has a limited number of days fj they are willing to drive. Give an algorithm to find a driver assignment di ∈ si each day i such that no person j has to drive more than their limit fj. (The algorithm should output “no” if there is no such assignment.) Hint: Use network flow. For example, for the following input with n = 3 and m = 3, the algorithm could assign Tom to Day 1 and Day 2, and Mark to Day 3. Person Day 1 Day 2 Day 3 Driving Limit 1 (Tom) x x x 2 2 (Mark) x   x 1 3 (Fred)   x x 0
Develop a dynamic programming algorithm for the knapsack problem: given n items of know weights w1, . . . , wn and values v1, . . . ,vn and a knapsack of capacity W, find the most valuable subset of the items that fit into the knapsack. We assume that all the weights and the knapsack’s capacity are positive integers, while the item values are positive real numbers. (This is the 0-1 knapsack problem).  Analyze the structure of an optimal solution. Give the recursive solution. Give a solution to this problem by writing pseudo code procedures. Analyze the running time for your algorithms.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole