edit: from OP's comments, the library was already performing the coalescing.
There's Discete Interval Encoding Tree (Diet). The basic idea is that, in a BST of intervals, if an insertion fills a hole of two intervals, they get merged into a single node.
Comments
edit: from OP's comments, the library was already performing the coalescing.
There's Discete Interval Encoding Tree (Diet). The basic idea is that, in a BST of intervals, if an insertion fills a hole of two intervals, they get merged into a single node.
The paper: https://web.engr.oregonstate.edu/~erwig/diet/
A Scala implementation example: https://typelevel.org/cats-collections/diet.html