Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Question
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,
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Classes are scheduled at a school. Once students have submitted their course requests, a computer algorithm can determine the optimal schedule for everyone.
The school has concluded that it will take too long to determine the best schedule. Instead, they resort to a less sophisticated method that produces a serviceable if not ideal timetable.
Which guiding concept is represented here?
A school is creating class schedules for its students. The students submit their requested courses and then a program will be designed to find the optimal schedule for all students.
The school has determined that finding the absolute best schedule cannot be solved in a reasonable time. Instead they have decided to use a simpler algorithm that produces a good but non-optimal schedule in a more reasonable amount of time.
Which principle does this decision best demonstrate?
using c++ ..Given a set of activities and the starting and finishing time of each activity, find themaximum number of activities that can be performed by a single person assuming that aperson can only work on a single activity at a time.This problem is called the activity selection problem, which concerns the selection ofnon-conflicting activities to perform within a given time frame, given a set of activities eachmarked by a start and finish time.
Input:11{1, 4}, {3, 5}, {0, 6}, {5, 7}, {3, 8}, {5, 9}, {6, 10}, {8, 11}, {8, 12}, {2, 13}, {12, 14}Output:4{1, 4}, {5, 7}, {8, 11}, {12, 14}
Chapter 16 Solutions
Introduction to Algorithms
Ch. 16.1 - Prob. 1ECh. 16.1 - Prob. 2ECh. 16.1 - Prob. 3ECh. 16.1 - Prob. 4ECh. 16.1 - Prob. 5ECh. 16.2 - Prob. 1ECh. 16.2 - Prob. 2ECh. 16.2 - Prob. 3ECh. 16.2 - Prob. 4ECh. 16.2 - Prob. 5E
Ch. 16.2 - Prob. 6ECh. 16.2 - Prob. 7ECh. 16.3 - Prob. 1ECh. 16.3 - Prob. 2ECh. 16.3 - Prob. 3ECh. 16.3 - Prob. 4ECh. 16.3 - Prob. 5ECh. 16.3 - Prob. 6ECh. 16.3 - Prob. 7ECh. 16.3 - Prob. 8ECh. 16.3 - Prob. 9ECh. 16.4 - Prob. 1ECh. 16.4 - Prob. 2ECh. 16.4 - Prob. 3ECh. 16.4 - Prob. 4ECh. 16.4 - Prob. 5ECh. 16.5 - Prob. 1ECh. 16.5 - Prob. 2ECh. 16 - Prob. 1PCh. 16 - Prob. 2PCh. 16 - Prob. 3PCh. 16 - Prob. 4PCh. 16 - Prob. 5P
Knowledge Booster
Similar questions
- . The vacuum cleaner problem is a well-known search problem for a vacuum cleaner robot that works on Artificial Intelligence. In this problem to clean up the whole area. In the superficial world, the vacuum cleaner agent has a location sensor and a dirt sensor to know where it is (room A, room B, or any n room) and whether the room is dirty. Also, the robot needs to avoid the obstacle (stool) and find a new path. A possible performance measure is to maximize the number of clean rooms over a certain period. For this problem, four main conditions should be considered: in(x,y) means a robot at (x,y) dirt(x,y) means there is a dirt at(x,y) facing(d) means the robot is facing direction d, where d ={north, east, south, west} • hit(s) means the robot hits the obstacle s possible actions the robot can do - turn, forward, suck-dirt, avoid a) Write possible rules that can be used to perform the room cleaning plan b) Execute this plan…arrow_forwardA problem with optimization is specified:The input is one instance as a prerequisite.Postconditions: The result is one of the acceptable solutions in this situation, with the best (minimum or maximum, as appropriate) success metric. (The outputted solution need not be original.)arrow_forwardConsider a set of n independent tasks. All tasks arrive at t = 0. Each task Ti is characterized by its computation time Ci and deadline Di. Prove that EDF is optimal for both preemptive AND non-preemptive cases. please type the answersarrow_forward
- From dynamic programming c. If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called ___________ .arrow_forwardUsing c++ Apply both breadth-first search and best-first search to a modified version of MC problem. In the modified MC, a state can contain any number of M’s and any number of C’s on either side of the river. Assume the goal is always to move all the persons on the left side to the right side. The Initial state should be a parameter given to the program at beginning of execution. As in the original problem, boat capacity =2, the boat cannot move by itself, and on either side C’s should not outnumber M’s. For best-first search, you need to come up with an appropriate heuristic. In addition to solving the problem, your grade will also be based on th effectiveness of the heuristic. As an example, the program should execute as follows. Initial state… Enter number of M’s on left side of the river: 3 Enter number of C’s on left side of the river: 1 Enter number of M’s on right side of the river: 0 Enter number of C’s on right side of the river: 0 Enter location of the boat: L The output…arrow_forwardConsider the search problem represented in Figure, where a is the start node and e is the goal node. The pair [f, h] at each node indicates the value ofthe f and h functions for the path ending at that node. Given this information, what is the cost ofeach path?1. The cost < a, c >= 2 is given as a hint.2. Is the heuristic function h admissible? Explainarrow_forward
- Algorithm to Linear MI-NSVMInitialize: Given a training set;Choose appropriate penalty parameters c1,c2 > 0;Setting initial values for (k = 1), where λij (1)j ∈ s ← (i);i = 1;...; m+ ;arrow_forwardAssume there are n courses offered by the university, where each course has one or no prerequisites.If course j is the prerequisite for course i, then we are only allowed to take course i after course j. And after taking each course i, we can get a reward r_i. Given the reward and prerequisite for each course, design analgorithm to find the maximum total reward we can get by taking m courses. The time complexity shouldbe O(nm^2). Please only answer if you have the algorithmarrow_forwardThe learning problem is to find the unknown (functional) relationship hy between objects x X and targets y y based solely on a sample z = (x, y) = ((x1, Y1), ..., (xms Ym)) = (X × y)m of size meN drawn iid from an unknown distribution Pxy. If the output space Y contains a finite number Y of elements then the task is called a classification learning problem.arrow_forward
- Not every greedy approach works. For activity selection problem, your book gives examples which shows that the following greedy strategies don't work: the earliest start time, the shortest-duration activity, and the activity with the fewest overlaps. Give concrete examples to show that the 0-1 knapsack problem doesn’t work for: (a) the heaviest item first, (b) the lightest item first, (c) the most expensive item first, and (d) the least expensive item first.arrow_forwarda. Given n items, where each item has a weight and a value, and a knapsack that can carry at most W You are expected to fill in the knapsack with a subset of items in order to maximize the total value without exceeding the weight limit. For instance, if n = 6 and items = {(A, 10, 40), (B, 50, 30), (C, 40, 80), (D, 20, 60), (E, 40, 10), (F, 10, 60)} where each entry is represented as (itemIdi, weighti, valuei). Use greedy algorithm to solve the fractional knapsack problem. b. Given an array of n numbers, write a java or python program to find the k largest numbers using a comparison-based algorithm. We are not interested in the relative order of the k numbers and assuming that (i) k is a small constant (e.g., k = 5) independent of n, and (ii) k is a constant fraction of n (e.g., k = n/4). Provide the Big-Oh characterization of your algorithm.arrow_forwardThis characteristic is met by a problem if it is feasible to develop an optimum solution for it by first creating optimal solutions for its subproblems. a) Subproblems that overlap; b) substructure that's optimum; c) memorization; d) greedyarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole