Answered step by step
Verified Expert Solution
Link Copied!

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 =5, and hi =1, h2=9, h3=5, ha =4, hs =7. So Carey should use the GPUs on the
2nd and 5th day so that she can use them for 9-: 7=16 hours
(a)(5 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 -1 as invalid;
L if i is not the last day, mark i +1 as invalid; return H;
(b)(10 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)[5 pts] Analyze the time and space complexity of your algorithm.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

2. Describe three common types of routine requests.

Answered: 1 week ago