Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointSearch Issue #11

Open
alikhanovlevon opened this issue Dec 18, 2017 · 1 comment
Open

PointSearch Issue #11

alikhanovlevon opened this issue Dec 18, 2017 · 1 comment

Comments

@alikhanovlevon
Copy link

Hello,

Please see the code below to find the issue that I have faced.

var itree = new IntervalTree(10);

itree.add(50, 80, 'foo');
itree.add(44, 199, 'bar');

itree.pointSearch(55);

The result of the last call should contain 2 objects, but it returns only one of them.
After digging a bit, I found out the in Node.js endPointSearch function calculates the index where 55 should be inserted.

index = this.ends.firstPositionOf({
end: val
});

The returned value is -1. So this code returns the last item in the list:
return this.ends.slice(index);

Can you please look into this?

Thanks,
Levon

@ephemer
Copy link

ephemer commented Apr 20, 2022

I just spent the afternoon painstakingly porting this code to Swift and then came across the same bug :(

I will try to debug this but I'm not sure it'll help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants