查找运行流中的间隔总数

时间:2018-07-04 16:55:04

标签: algorithm data-structures

我有格式为(start,end)的传入间隔流。(1 <= start

例如

(10,20) comes first-->No of distinct interval 1.
(50,60) comes next->No of distinct interval 2.
(5,11) comes next.->No of distinct interval 3.
(8,12) comes next.->No of distinct interval 3.(As (5,11) has merged with (10,20) and formed (5,20),so (8,12) completely falls in between (5,20),so it wont be counted).
(55,65) comes next.->No of distinct interval 4.(at this point (55,65) will merge with (50,60)).

如何解决这个问题? 就像我们可以制作自平衡间隔树的间隔堆一样吗? 如果是,怎么办?

0 个答案:

没有答案