-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fixes point_search when unique is false #14
base: master
Are you sure you want to change the base?
Conversation
This change implements point_search iteratively to ensure a stack overflow can not occur. It also makes the method use the passed unique parameter, as the recursive call was previously defaulting unique to true: itv = [(5...20), (15.6...20), (15.7...20), (15.7...20)] t = IntervalTree::Tree.new(itv) p t.search(15.7) #=> [5...20, 15.6...20, 15.7...20] p t.search(15.7, unique: false) #=> Should be [5...20, 15.6...20, 15.7...20, 15.7...20], not [5...20, 15.6...20, 15.7...20] again Additionally, result.uniq is invoked at the end of the method for faster query speeds.
Fixed point_search Indentation
Co-authored-by: amarzot-yesware <[email protected]>
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.
Cheers; good thinking.
Given this includes the removal of #include?
, from #13, let's rebase this once that PR is merged. In the meantime, would you mind adding a spec please? =)
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.
(I should have selected this, given the missing spec)
Hi @ZimbiX, In addition to that I also changed the text of the case in which Cheers! |
This change implements
point_search
iteratively to ensure a stack overflow can not occur.It also makes the method use the passed
unique
parameter, as the recursive call was previously defaulting unique to true:Additionally,
result.uniq
is invoked at the end of the method for faster query speeds.