Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Carey needs to use the university's GPU servers for her studies. Each semester, the servers are available for n consecutive days, but on each day
Carey needs to use the university's GPU servers for her studies. Each semester, the servers are available for n consecutive days, but on each day i they are only available for h hours. Also a student cannot connect to the GPUs
tor any two consecutive days. Carey wants to determine the days she should use the GRUs in order to maximize her GPU usage time.
For example, assume that n and hi h h ha hs So Carey should use the GPUs on the
nd and th day so that she can use them for : hours
a pts Provide a counter example to show that the following greedy algorithm does not always return the
correct days.
Initialize a set H to an empty set;
Mark all days as valid;
while there are some valid days do
choose a valid day i with maximum hi; add he to H;
if i is not the first day, mark i as invalid;
L if i is not the last day, mark i as invalid; return H;
b pts Provide a dynamic programming algorithm to solve the problem. The time complexity for your algorithm should be independent of his and must be polynomial in n
c pts Analyze the time and space complexity 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