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, Problem 2P
(a)
Program Plan Intro
To design an
(b)
Program Plan Intro
Tasks are running in the preemptive fashion and cannot occur at the same time.Todesign algorithm to schedule tasks to minimizesthe average completion time and to show its complexity.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
[Job sequencing using deadlines]Let us suppose that there are n jobs (J1, J2, … Jn) each of which takes a unit oftime to be processed by a machine and there is just one single machine to processthe jobs. Let us suppose that (d1, d2, d3, …dn) are the deadlines in units of times to complete the jobs and (p1, p2, p3, …pn) are the profits earned if the jobs are processed within the deadline. The objective is obviously to select those jobs and complete them within their deadlines so that maximum profit is earned.Design a greedy method to obtain the optimal sequence of jobs that will earnmaximum profits. Demonstrate it on the case where there are four jobs, with n = 4,deadlines given by (d1 = 2, d2 = 1, d3 = 3, d4 = 1) and profits earned as (p1 = 100,p2 = 20, p3 = 50, p4 = 40).
Show three periodic tasks that do not satisfy the simple schedulable utilization (Schedulability Test 2) but can still be RM-scheduled.
(test 2 Utilization U = sum c_i / p_i Number of tasks n A task set is schedulable if U <= n(2^(1/n) – 1))
Please type it out
Graph TheorySuppose that a random selection of students will be able to screen a new movie early. There arefour screening sessions. For scheduling purposes, each of the selected students will specify whichof the four screenings don’t conflict with their schedule—every student is available for at least twoout of the four screenings. However, each screening has only 20 available seats, not all of whichneed to be filled each time. The event organizers are faced with a difficult scheduling problem:how do they make sure each of the chosen students is able to find a seat at a screening? They’verecruited you to help solve this dilemma.
(a) Describe how to model this situation as a matching problem. Be sure to specify whatthe vertices/edges should be and briefly describe how a matching would determine seatassignments for each student in a screening for which they are available. (This is a modelingproblem; we aren’t looking for a description of an algorithm to solve the problem.)
(b) Suppose 41…
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
- (i) Describe Banker’s algorithm for deadlock avoidance with supporting example Consider a computer system with has four identical units of a resource R. There are three processes each with a maximum claim of two units of resource R. Processes can request these resources in anyway, that is, two in one shot or one by one. The system always satisfies a request a request for a resource if enough resources are available. If the process doesn’t request any other kind of resource, show that the system never deadlock Give a solution for the following synchronization problem using semaphores Producer- Consumer Problem Readers- Writers Problem List out the issues in preprocessor scheduling that causes performance degradation in multiprocessor systemsarrow_forwardThere are ? tasks assigned to ? workers, and each worker can be assigned only one task. Each worker can complete any one of the tasks, but the time spent varies. Use the ant colony algorithm to find the best allocation scheme that minimizes the total time spent. Please write a program to solve the problem (with python/C/C++)arrow_forwardThere are N cranes (numbered from 0 to N -1) arranged in a line along a road. Road begins at position 0. The K-th crane is located at distance P[K] from the beginning of the road and its arm length is equal to A[K]. The cranes cannot change their positions. There is a package, initially located at position B, that has to be moved by the cranes to position E. The K-th crane can pick up the package only if the distance between its position...... Task from I need solve by Javaarrow_forward
- Correct answer will be upvoted else downvoted. Polycarp can just settle one errand during the day. Consistently he recorded what task he tackled. Presently the educator needs to know whether Polycarp followed his recommendation. For instance, assuming Polycarp tackled errands in the accompanying request: "DDBBCCCBBEZ", the educator will see that on the third day Polycarp started to settle the assignment 'B', then, at that point, on the fifth day he got occupied and started to address the undertaking 'C', on the eighth day Polycarp got back to the assignment 'B'. Different instances of when the educator is dubious: "BAB", "AABBCCDDEEBZZ" and "AAAAZAAAAA". Assuming Polycarp addressed the errands as follows: "FFGZZZY", the educator can't have any doubts. Kindly note that Polycarp isn't committed to settle all errands. Different instances of when the instructor doesn't have any dubious: "BA", "AFFFCC" and "YYYYY". Assist Polycarp with seeing whether his educator may be dubious.…arrow_forwardSuppose you are given n tasks J = {j1, j2, · · · jn}.Each task ji has two parts - a preprocessing phase which takes pi units and a main phase whichtakes fi units of time. There are n machines that can execute the main phases of the jobs in parallel.However, the preprocessing phases need to be executed sequentially on a special machine. Thecompletion time of any schedule is the earliest time when all tasks have finished execution. Designa greedy algorithm which produces a schedule that minimizes the completion time. Here, youneed to give formal proof of correctness. Your proof should not exceed one side of an A4 sheet.Anything more than that will not be considered by the evaluator. Provide only pseudocode.arrow_forwardSuppose that a manufacturing company builds n different types of robots, sayrobots 1, 2, . . . , n. These robots are made from a common set of m types of materials, saymaterials 1, 2, . . . , m. The company has only a limited supply of materials for each year,the amount of materials 1, 2, . . . , m are limited by the numbers b1, b2, . . . , bm, respectively.Building robot i requires an aij amount from material j. For example, building robot 1requires a11 from material 1, a12 from material 2, etc. Suppose the profit made by sellingrobot i is pi. Write an integer linear program for maximizing the annual profit for thecompanyarrow_forward
- After college, a group of students of a certain height planned to go to the movies. The cinema they go to is quite unique because the number of cinema rows is always 2 and the number of seats is as many as the number of students. Because this is a unique cinema, the way they sit is also unique. They will try to minimize their height difference with the one next to it so that the biggest height difference of each pair of students next to each other is as minimal as possible. Example: There are 6 students with height of 1, 6, 9, 7, 2, and 3. There are various sequences that can produce the biggest difference in height. Ordering 1:1 3 62 7 9Difference 1 and 3 is 2.Difference 3 and 6 is 3.Difference 2 and 7 is 5.Difference 7 and 9 is 2.So the biggest difference in height is 5. Ordering 2:1 3 26 7 9The biggest difference in height is 2.This difference is also an optimal answer. Format Input : There are T test cases. Each testcase contains integers N which indicates the number of students…arrow_forwardDynamic Programming Given a row of factory A, B, C, D, E, F, G, H. Goal: find the max amount of pollution that can be lessen by demolishing these factories. Condition: If a factory is chosen to be destroyed, the two factories adjacent to it cant be selected. Eg: if factory E was picked, factories C, D, F and G cant be selected. Question: Find the base case and the recurrence function. Write pseudocode and a program in C++ based on the above condition.arrow_forwardA deadlock is the very unpleasant situation that may occur in very dynamic world of running processes, a situation that must be avoided at all costs. One famous algorithm for deadlock avoidance is the Banker's algorithm for deadlock avoidance. The version of this algorithm presented in this module's commentary gives just one solution (the Greedy approach). Consider the Greedy approach to the Banker's algorithm. Give an example of application of this algorithm for 7 processes (named P1, ... , P7) and 5 resource types (named R1, ... , R5). Start by listing the matrices involved in this algorithm, that constitute its input data; also, do not forget to mention the overall resources of each type available in this fictional system. Proceed by describing the algorithm, step by step; for each step, mention the test performed, which process was chosen, what is the old and new status of the Work array, etc. In the end, list the solution, that is the safe sequence of processes resulting from this…arrow_forward
- The wait-for graph scheme is not applicable to a resource-allocation system with multiple instances of eachresource type. We need a deadlock detection algorithm that is applicable to such a system. The algorithm employsseveral time-varying data structure that are similar to those used in the banker’s algorithm. Available. A vector of length ? indicates the number of available resources of each type. Allocation: An ? × ? matrix defines the number of resources of each type currently allocated to eachthread Request: An ? × ? matrix indicates the current request of each thread. If Request[i][ j] equals ?, thenthread ?i is requesting ? more instances of resource type ?jThe ≤ relation between two vectors denotes as follows:Let ? and ? be vectors of length ?. We say that ? ≤ ? if and only if ?[?] ≤ ?[?] for all ? = 1,2, . . , ?. For example,if ? = (1,7,3,2) and ? = (0,3,2,1), then ? ≤ ?. In addition, ? < ? if ? ≤ ? and ? ≠ ?. We can treat each row in the matrices ?????????? and ??????? as…arrow_forwardNeed Help with Octave: function [w, t, flag] = margin_pcpt(X, y, max_iter, max_margin)[m, n] = size(X);flag = 0;w = zeros(n, 1);t = 1;while (t < max_iter) && (flag == 0)% Your tasks: % 1. searches for violation point p such that % (a) the label disagrees with p*w; OR % (b) the distance between p and seperation line is too close, i.e. % p*(w./norm(w, 2)) <= max_margin % 2. update the seperation plane vector w % 3. if there is no more violation point, set flag = 1. t = t + 1;end% as a good habit: normalise the seperation vector by it's normw = w./norm(w, 2);endarrow_forwardQUESTION TWO A. (i) Describe Banker’s algorithm for deadlock avoidance with supporting example (ii)Consider a computer system with has four identical units of a resource R. There are three processes each with a maximum claim of two units of resource R. Processes can request these resources in anyway, that is, two in one shot or one by one. The system always satisfies a request a request for a resource if enough resources are available. If the process doesn’t request any other kind of resource, show that the system never deadlock B. Give a solution for the following synchronization problem using semaphores (i)Producer- Consumer Problem (ii)Readers- Writers Problem C. List out the issues in preprocessor scheduling that causes performance degradation in multiprocessor systemsarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education