Given a set of black and white intervals, select a smallest number of white inte
ID: 3849870 • Letter: G
Question
Given a set of black and white intervals, select a smallest number of white intervals that collectively overlap every black interval. State your greedy choice and prove its correctness.Give the full algorithm and state the greedy choice and state its correctness Given a set of black and white intervals, select a smallest number of white intervals that collectively overlap every black interval. State your greedy choice and prove its correctness.
Give the full algorithm and state the greedy choice and state its correctness Given a set of black and white intervals, select a smallest number of white intervals that collectively overlap every black interval. State your greedy choice and prove its correctness.
Give the full algorithm and state the greedy choice and state its correctness
Explanation / Answer
solution--
1. Find the length of max black interval -->blk
2.Sort the white intervals in decreasing order of length.
3.Start selecting white intervals until the sum of lengths of white intervals becomes greater than or equal to blk.
Greedy choice here is selecting from the largest white interval so that the number of interval is minimum which is the aim of the question.
If you take any small interval instead of big one you will have to take more number of that which will defeat the purpose of the question , hence proved.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.