in Algorithms
688 views
2 votes
2 votes

Your final exams are over and you are catching up on watching sports on TV. You have a schedule of interesting matches coming up all over the world during the next week. You hate to start or stop watching a match midway, so your aim is to watch as many complete matches as possible during the week.
Suppose there are $n$ such matches scheduled during the coming week and you know the starting and finishing time for each match.

Develop an algorithm based on dynamic programming to compute the maximum number of complete matches you can watch next week. Analyze the worse-case complexity of your algorithm.

in Algorithms
by
2437 3623 5535
688 views

Subscribe to GO Classes for GATE CSE 2022

3 Answers

0 votes
0 votes

arjun sir, i need ur favour,so that i may solve the problem

Is this problem a bit similar to NON-PRE-EMPTIVE SJF:

where start time of match is same as ARRIVAL TIME of process.

end time of match is same as COMPLETION TIME of process.

  time duration of match is same as BURST TIME  of process.

hate to start & stop is same as non-pre-emption.smiley

by
10 27 74

3 Comments

Yes, it is same. But only issue is we have a fixed time limit within which to finish all the jobs- which is usually not there in process scheduling problem.
0
0
ok
0
0
Activity selection problem using dynamic programming can be the answer
0
0
0 votes
0 votes

Answer:

by
21 161
0 votes
0 votes
This can be solved using graph coloring problem !

A[] = array of shows( names/nos ).

B[] = start times in order.

C[] = end times in order.

 

Let G(V,E ) be our graph where V = shows.

      There exists an edge between any two vertices if their timings overlap .   O(n^2) to create the graph. ( and overall Tn ).

Now with graph coloring comes in. The nodes which have different colour can be seen fully !

We do this with BFS ( O(v+e) ).

 

@Arjun Sir, kindly do check my logic here

Related questions