2.Help please!! I need help with this problem. no coding just math Greedy Algori
ID: 3766609 • Letter: 2
Question
2.Help please!! I need help with this problem. no coding just math
Greedy Algorithms. You're in charge of the Boeing 737NG flight simulator in Singapore. This Friday pilots from several major airlines are in town and are available for simulator training. However, only one pilot can be in the simulator at one time, and each pilot most can only receive the training during a specific window of time. Given a set P a [P_1, P_2, ..., P_n) of n pilots who have training windows with start and finish times (s_i, f_i,), 1Explanation / Answer
Let I be the set of intervals (si,fi) 1<=i<=n .
Greedy Algorithm:
Let S be the solution set.
Initialize it to empty.
1) sort I according to the right most end and let the Sorted I be Is.
2) add the first interval of Is to S.
3) Iterate throgh Is starting from the second interval and c be the current interval of iteration in Is.
4) If the left end of c is greater than right end of last interval that was added to S then we add c to S.
5) If the left end of c is not greater than right end of last interval that was added to S then we just move to the next interval of Is.
Finally S is the solution to the given problem.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.