*Language must be Java* Overview: Recall the IntervalScheduling problem: you are given a set of intervals and asked to f

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

*Language must be Java* Overview: Recall the IntervalScheduling problem: you are given a set of intervals and asked to f

Post by answerhappygod »

*Language must be Java*Overview: Recall the IntervalScheduling problem: you are given aset of intervals and asked to find thelargest cardinality subset that has no overlapping intervals. Wefound that the EarliestStartingTimealgorithm was not optimal by finding an instance where it did notget the best possible solution. Occassion-ally, you will want to test an algorithm on a problem to find aninstance where it does not get the optimalsolution.Details: The input will come from a file called input.txt whichwill be placed in the same directory asyour java file. The first line of the file will have a singleinteger value N which will be the number ofintervals. The next N lines will be the intervals represented by siand fi seperated by whitespace. Yourprogram should output a single integer which is the number ofnon-overlapping intervals found by theEarliestFinishingTime algorithm. It is likely that the number ofintervals found will not be the optimalsolution. See the sample input below for examples.Thank you!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply