Question
A system is computing results for a set of different requests. Each request is answered by first querying a database, and then processing the query
A system is computing results for a set of different requests. Each request is answered by first querying a database, and then processing the query results to produce an answer. The system can process the query results in parallel (with one processor per request), but querying the database itself must be done sequentially (one request at a time).
Consider that we have an entire set of requests, and we can respond to them in any order we wish. We also have, for each request i, the time qi that will be needed to query the database and the time pi that will be needed to process the query results into the answer.
Processing this set of requests is monopolizing our system, so we would like to complete the entire process as soon as possible.
1. Design and write a greedy algorithm that, given the times qi and pi needed for each of n requests, will find the minimum time elapsed from the start of the first query until all requests have been answered.
2. Prove that your algorithm always finds an optimum result.
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