Q4 10 Suppose you are a cable guy and are sent out for jobs to complete in a single day. Given job j; each has a start time s; and finish time f;. Your goal is to complete the most number of jobs assigned. The only requirement is you are allowed to start a job late by y minutes, (there is no travel time between jobs). Otherwise, there is no allowed overlap. So I can have a job that goes 1pm-1:37pm and start another one that goes from 1:30pm to 2:30pm PART A Create and analyze code for a greedy algorithm that follows the greedy strategy of choosing the job that starts the latest compatible to currently selected jobs. (HINT you can order jobs in order of decreasing start time) Part B Prove that the greedy strategy of choosing the job that starts the latest is possible in an optimal solution. (Greedy choice property)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question

Please solve the following greedy algorithms problem: (show all work and solve asap)

given: y = 9 

Q4
10
Suppose you are a cable guy and are sent out for jobs to complete in a single day. Given
job j; each has a start time s; and finish time f;. Your goal is to complete the most
number of jobs assigned. The only requirement is you are allowed to start a job late by y
minutes, (there is no travel time between jobs). Otherwise, there is no allowed overlap. So
I can have a job that goes 1pm-1:37pm and start another one that goes from 1:30pm to
2:30pm
PART A
Create and analyze code for a greedy algorithm that follows the greedy strategy of
choosing the job that starts the latest compatible to currently selected jobs. (HINT you
can order jobs in order of decreasing start time)
Part B
Prove that the greedy strategy of choosing the job that starts the latest is possible in an
optimal solution. (Greedy choice property)
Transcribed Image Text:Q4 10 Suppose you are a cable guy and are sent out for jobs to complete in a single day. Given job j; each has a start time s; and finish time f;. Your goal is to complete the most number of jobs assigned. The only requirement is you are allowed to start a job late by y minutes, (there is no travel time between jobs). Otherwise, there is no allowed overlap. So I can have a job that goes 1pm-1:37pm and start another one that goes from 1:30pm to 2:30pm PART A Create and analyze code for a greedy algorithm that follows the greedy strategy of choosing the job that starts the latest compatible to currently selected jobs. (HINT you can order jobs in order of decreasing start time) Part B Prove that the greedy strategy of choosing the job that starts the latest is possible in an optimal solution. (Greedy choice property)
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage