Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(40 marks) Consider the following optimization problem. You are are writing your final term paper for PHIL 999. You have taken n books out of
(40 marks) Consider the following optimization problem. You are are writing your final term paper for PHIL 999. You have taken n books out of the library that you need for your paper, and you have read none of them. The books are all overdue by now, and the library is charging you a late fee of S1 per day per book. For each book j, you have already determined that it will take you tj days to read the book. You can only read one book at a time, and you want to return each book as soon as you finish it so you won't have to pay late fees on a book you have finished reading. The library books problem is to find the order in which to read all n books that minimizes the late fees. (a) (5 marks) Give a formal definition (pre- and post-conditions) of the problem described. (b) (5 marks) Consider the case where there are three books that take t 10, t2 5, and t3- 8 days to read, respectively. What is the optimal solution to the problem? (c) (10 marks) Give an efficient greedy algorithm that finds an optimal solution for the general case. (d) (5 marks) Explain why your algorithm returns an optimal solution (e) (10 marks) Prove that your algorithm returns an/the optimal solution. (f) (5 marks) Prove a tight asymptotic bound on the running time of your algorithm (40 marks) Consider the following optimization problem. You are are writing your final term paper for PHIL 999. You have taken n books out of the library that you need for your paper, and you have read none of them. The books are all overdue by now, and the library is charging you a late fee of S1 per day per book. For each book j, you have already determined that it will take you tj days to read the book. You can only read one book at a time, and you want to return each book as soon as you finish it so you won't have to pay late fees on a book you have finished reading. The library books problem is to find the order in which to read all n books that minimizes the late fees. (a) (5 marks) Give a formal definition (pre- and post-conditions) of the problem described. (b) (5 marks) Consider the case where there are three books that take t 10, t2 5, and t3- 8 days to read, respectively. What is the optimal solution to the problem? (c) (10 marks) Give an efficient greedy algorithm that finds an optimal solution for the general case. (d) (5 marks) Explain why your algorithm returns an optimal solution (e) (10 marks) Prove that your algorithm returns an/the optimal solution. (f) (5 marks) Prove a tight asymptotic bound on the running time of your algorithm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started