Consider a problem in which you have a list J of jobs, each of which takes the same amount of time to complete. You need to schedule these jobs in array S, indexed from 0 to n. Each job occupies a single index in the array, because they each take the same amount of time to complete. Each job j e J has: •deadline j.deadline from 0 to n, denoting the latest index in S at which it can be scheduled. •profit j.profit, denoting the profit or gain from completing job j. The goal is to maximize the sum of profits of the jobs scheduled in S. |J| can be greater than |S|, so it might not be possible to schedule all jobs. There is no penalty for leaving a job undone. Consider the following algorithm: Job Scheduling IN : List J of jobs, max index n 1 S+ an array indexed 0 to n, with null at each index 2 Sort J in non-increasing order of profits 3 for i from 0 to n Find the largest t such that S[t] = null and t < J[i].deadline (if one exists) if an index t was found | S[t] + J[i] OUT: S maximizes the profit of scheduled jobs Note that – is used to denote assignment; x + y means that x is assigned the value of y. Prove that the algorithm is correct. HINT: A schedule S is promising if it can be extended to an optimal schedule by scheduling jobs that have not yet been considered. If S is promising after all jobs have been considered, then S is an optimal schedule.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Consider a problem in which you have a list J of jobs, each of which takes the same amount of
time to complete. You need to schedule these jobs in array S, indexed from 0 to n. Each job
occupies a single index in the array, because they each take the same amount of time to complete.
Each job j e J has:
odeadline j.deadline from 0 to n, denoting the latest index in S at which it can be scheduled.
•profit j.profit, denoting the profit or gain from completing job j.
The goal is to maximize the sum of profits of the jobs scheduled in S. |J| can be greater than |S],
so it might not be possible to schedule all jobs. There is no penalty for leaving a job undone.
Consider the following algorithm:
Job Scheduling
IN : List J of jobs, max index n
1 S+ an array indexed 0 to n, with null at each index
2 Sort J in non-increasing order of profits
3 for i from 0 to n
Find the largest t such that S[t] = null and t < J[i].deadline (if one exists)
if an index t was found
| St] + J[i]
OUT: S maximizes the profit of scheduled jobs
6
Note that - is used to denote assignment; x - y means that r is assigned the value of y.
Prove that the algorithm is correct.
HINT: A schedule S is promising if it can be extended to an optimal schedule by scheduling jobs
that have not yet been considered. If S is promising after all jobs have been considered, then S is
an optimal schedule.
Transcribed Image Text:Consider a problem in which you have a list J of jobs, each of which takes the same amount of time to complete. You need to schedule these jobs in array S, indexed from 0 to n. Each job occupies a single index in the array, because they each take the same amount of time to complete. Each job j e J has: odeadline j.deadline from 0 to n, denoting the latest index in S at which it can be scheduled. •profit j.profit, denoting the profit or gain from completing job j. The goal is to maximize the sum of profits of the jobs scheduled in S. |J| can be greater than |S], so it might not be possible to schedule all jobs. There is no penalty for leaving a job undone. Consider the following algorithm: Job Scheduling IN : List J of jobs, max index n 1 S+ an array indexed 0 to n, with null at each index 2 Sort J in non-increasing order of profits 3 for i from 0 to n Find the largest t such that S[t] = null and t < J[i].deadline (if one exists) if an index t was found | St] + J[i] OUT: S maximizes the profit of scheduled jobs 6 Note that - is used to denote assignment; x - y means that r is assigned the value of y. Prove that the algorithm is correct. HINT: A schedule S is promising if it can be extended to an optimal schedule by scheduling jobs that have not yet been considered. If S is promising after all jobs have been considered, then S is an optimal schedule.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education