*Language must be Java*
Overview: Recall the IntervalScheduling problem: you are given aset of intervals and asked to find the largest cardinality subsetthat has no overlapping intervals. We found that theEarliestStartingTime algorithm was not optimal by finding aninstance where it did not get the best possible solution.Occassion- ally, you will want to test an algorithm on a problem tofind an instance where it does not get the optimal solution.
Details: The input will come from a file called input.txt whichwill be placed in the same directory as your java file. The firstline of the file will have a single integer value N which will bethe number of intervals. The next N lines will be the intervalsrepresented by si and fi seperated by whitespace. Your programshould output a single integer which is the number ofnon-overlapping intervals found by the EarliestFinishingTimealgorithm. It is likely that the number of intervals found will notbe the optimal solution. See the sample input below forexamples.
Sample execution:
If input.txt contains
8
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
then the output should be 1
If input.txt contains 5
1 10
2 3
4 5
6 7
8 9 then the output should be 1
Thank you!
*Language must be Java* Overview: Recall the IntervalScheduling problem: you are given a set of intervals and asked to f
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am