HW3_April2018_answers.pdf

Part b sort the employees by skill level and sort the

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Part b: Sort the employees by skill level, and sort the tasks by difficulty level. Then assign the least skilled worker to the easiest task, the second- least skilled worker to the second-easiest task, etc. Q3 : Set P (0 , 0) = True. Set P (0 , W ) = False for all W > 0. Set P ( i, 0) = True for all i . Then to calculate P ( i, W ), we need solutions to P ( i - 1 , W ) and P ( i - 1 , W - v i ) (the first corresponds to the case when coin i is not used, and the second corresponds to the case when it is used). If either of these two subproblems is True, then set P ( i, W ) = True. We need to solve the subproblems in the correct order. To solve the subproblem for coin i , we should solve all subproblems for coin i - 1 first. So if we go in increasing order of i , we will accomplish this. As we iterate over the i values, it doesn’t matter what order we consider the various W orders in, so let’s just say we go in increasing order of W . Q4 : Define C [ i ] to be the cheapest way to get to rental shop i . If you stop at shop i , you could have potentially stopped at any of the previous shops along the river immediately before you got to shop i . These are the subprob- lems. If you know the cost to get to shop j , where j < i , then how can you use that to figure out the cost to get to shop i ? You can use either a one dimensional array or shortest path algorithm for DAGs to answer this ques- 1
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
tions. To be able to keep track of the shops define a one dimensional array prev where prev [ i
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern