alexbol99 / flatten-interval-tree

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

Unable to remove/find some of the nodes #15

Closed Restuta closed 4 years ago

Restuta commented 4 years ago

Test setup:

const IntervalTree = require('@flatten-js/interval-tree').default
const intervalTree3 = new IntervalTree()

intervalTree3.insert([2, 5], 10)
intervalTree3.insert([2, 5], 20)
intervalTree3.insert([2, 5], 30)

if (!intervalTree3.exist([2, 5], 10)) {
  console.log('item does not exist')
}

Runkit https://runkit.com/embed/mv6xfvsl298g

Specifically it can't find what used to be a "root" node. I debugged code a little bit and it doesn't seem like node with value 10 is part of the traversal. It seems that the issue is somewhere around this line:

https://github.com/alexbol99/flatten-interval-tree/blob/master/src/classes/intervalTree.js#L457

But I am not certain.

alexbol99 commented 4 years ago

Hello, Anton, Bug fixed in v1.0.11. Thank you for collaboration.

Restuta commented 4 years ago

Wow, quick turnaround. Thank you so much for your contributions! 🎉