alexbol99 / flatten-interval-tree

Interval binary search tree
MIT License
41 stars 21 forks source link

fix: finds the lowest intersecting interval #47

Closed theSherwood closed 11 months ago

theSherwood commented 11 months ago

I found a bug in my previous implementation that the tests didn't catch. So I've added a new test that catches it and fixed the implementation to pass the test.

Essentially, the problem was that if a node was found that was less than and also intersecting with the search node, the algorithm wouldn't search any further left. In the case of an intersecting node, we always want to look further left to find the lowest intersecting node possible.

Let me know if you find any issues/have any concerns!