及时查找重叠的事件(查找重叠的间隔)
我有一个随时间重叠的事件列表。通常认为事件跨越一段时间,但是事件可以具有相同的开始和结束时间(即时间点事件)。我想标记属于属于的事件。
例如,
event | start_time | end_time
A | 15:00:01 | 15:01:03
B | 10:12:11 | 10:15:09
C | 10:13:59 | 10:14:33
D | 10:12:11 | 10:12:11
E | 14:59:30 | 15:00:01
F | 17:00:12 | 17:01:01
列表可以持续更长的时间,但是在上面的情况下,事件A和E应该组合在一起,B,C和D应该在一起,并且F本身就是。什么是有效的算法?我可以进行一些简单的间隔扫描,但我不相信我知道任何专门为此设计的算法。
I have a list of events that are overlapping in time. An event is generally considered to span a period of time but events can have the same start and end times (i.e. point-in-time event). I'd like to mark events that belong together.
For example,
event | start_time | end_time
A | 15:00:01 | 15:01:03
B | 10:12:11 | 10:15:09
C | 10:13:59 | 10:14:33
D | 10:12:11 | 10:12:11
E | 14:59:30 | 15:00:01
F | 17:00:12 | 17:01:01
The list can go on longer but in the case above, events A and E should be grouped together and B, C, and D should be together and F is by itself. What is an efficient algorithm? I can do some simple interval scanning but I don't believe I know any algorithms specifically designed for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论