Question: A student taking a test uses greedy strategies to maximize the test results. The input to this problem consists of the test time K
A student taking a test uses greedy strategies to maximize the test results. The input to this problem consists of the test time K in minutes, and the (estimated) times to solve each of the n questions on the test, T[1..n], where time T[i]> 0 is the time in minutes for solving question i, 1 i n. We assume no partial credits will be given; thus a completed test question gets full credits while incomplete answers get 0 credits. We also assume that T[i] > K so that there is not enough time to solve all test questions. (a) (4 marks) Assume that the goal is to maximize the total amount of time the student uses for the completed test questions. Does a greedy algorithm that chooses the longest question at each step (always) generates optimal solutions? If not, given a counterexample. (b) (11 marks) Assume that the goal is to maximize the total number of completed test questions. Design a greedy algorithm for it and prove that your algorithm is correct (always generates optimal solutions).
Step by Step Solution
There are 3 Steps involved in it
The required answer is as follows theway PantA step 3 step2 stip... View full answer
Get step-by-step solutions from verified subject matter experts
