Greedy strategy: Select the disjoint interval problem.
Abstract Description: Give n intervals [Ai,bi], from which to select as many intervals as possible, so that these intervals can not intersect. Application of practical problems: This model is often examined as a carrier of the actual problem of the schedule.
Greedy Strategy Analysis:
The first thing we should understand is that if an interval C is a sub-range of another interval D, then obviously we will not go to the inter-constituency d.
So now let's analyze what might happen throughout the decision-making process.
Obviously we should analyze the adjacent interval. Give 3 intervals [A1,B1], [A2,B2], [A3,B3], and determine the relationship of the right end of the interval to B1<B2<B3, which allows us to determine a variable to parse another variable.
For A1>A2, this is the inclusion of what we said above.
For A1<A2, in this case, we will discuss the relationship between the interval [a3,b3] and the interval [A1,B1].
i) if the two do not intersect, obviously we are for interval 1 and interval 2, it is necessary to select the interval 1. Someone might ask why not discuss the relationship between interval 3 and interval 2? It is clear that the intersection of interval 3 and interval 2 must be discussed, otherwise the whole situation will not be discussed.
II) if the two intersect so that the three intervals have intersecting parts, obviously we still choose interval 1, because its b1 is the smallest, so in the subsequent decision (so the selection of the process of the interval based on BI from small to large sorting), can be as far as possible to make room for the other interval.
So we get greedy strategies, sort the bands for BI, select the first element of the linear table of the storage interval, and then delete the element and the interval that intersects the element.
"Getting Started classic"--6.28