-
Notifications
You must be signed in to change notification settings - Fork 38
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
Fix touching window #736
Fix touching window #736
Conversation
Hej @dachengx I am a little bit hesitant in merging your PR as the code gets much more complex. I do not know if we really need to cover every single edge case which is actually forbidden based on the provided doc-string. Did not we just add the consistency check for this very same reason? In addition, I think one should try to avoid using |
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dacheng, to me it looks fine. Although I am a little bit concerned performance wise. However, this should now lead to correct results.
What is the problem / what does the code in this PR do
In some insane cases, where both
endtime
ofthings
andcontainer
are not sorted, like:The current algorithm will give wrong results:
The correct answer is:
Can you briefly describe how it works?
The new algorithm only search for interval when the
time
andendtime
ofthings
andcontainers
are sorted. If not, we first sort them and record theargsort
, then later recover the order followingargsort
of input.When
things
'endtime
are not sorted, we will return the indices of the first and last things which are touching the container. So we return the minimum index inargsort
.Can you give a minimal working example (or illustrate with a figure)?
Please include the following if applicable:
Please make sure that all automated tests have passed before asking for a review (you can save the PR as a draft otherwise).