2012-06-02 30 views
2

鉴于:集合间隔集合。示例{{(1,2),(3,4)},{(1,3)},{(13,14)}}如何获得Intervalls集合中没有重叠Intervalls集合的最大子集

通缉结果:最大的子集,其中没有间隔与另一个每一组成对。

例子:

 
Input {{(1,2), (3,4)}, {(1, 3)}, {(13,14)}} 

A possible Solution would be: {{(1,2), (3,4)}, {(13,14)}} 

Another could be {{(1, 3)}, {(13,14)}}, 
it's not important that the first solution has more 'subelements', 
its only important that 2 = |{{(1,2), (3,4)}, {(13,14)}}| = |{{(1, 3)}, {(13,14)}}| 

现在我期待有一个良好/有效的算法来解决这个问题。

注: 我选择开放Intervalls,所以很明显'边'不能重叠,例如(1,2)和(2,3)不重叠。

+0

你如何为{2,10,16}三元组定义的区别。两两相加,最小两两? – sukunrt

回答