News for hackers. Stuff that matters.
Re:Ask HN: What are some cool but obscure data structures yo... by zbobet2012 on Friday July 22, 2022 @02:58AM (#32189311)
A lot of people don't know about the related segment and interval trees. Both efficiently allow you to compute all time ranges that overlap a point. This can be generalized to higher dimensional spaces.

For example if you have a set of calendar invites with a start and stop time (say tens of millions of them) and you want to find all invites which span 12pm (that is start before 12 and end after 12) you want an interval tree.

https://en.wikipedia.org/wiki/Interval_tree

There are no comments on this comment yet.