2012-06-02 120 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

回答