trees: implement more TreeSet helper methods#42
Conversation
This PR introduces Above, AboveEqual, Below, and BelowEqual functions on TreeSet for creating subsets of elements that match the descriptive function name.
This PR adds support for TreeSet methods FirstAbove - the first element strictly above a value FirstAboveEqual - the first element above or equal to a value FirstBelow - the first element strictly below a value FirstBelowEqual - the first element below or equal to a value
lgfa29
left a comment
There was a problem hiding this comment.
LGTM! Minor doc comment, but not a big deal.
| - TopK (`TreeSet` only) | ||
| - BottomK (`TreeSet` only) | ||
|
|
||
| TreeSet helper methods |
There was a problem hiding this comment.
So these are the methods only available for TreeSet? Being nested under the # TreeSet title makes it seem like everything only applies to TreeSet.
There was a problem hiding this comment.
Yup that's correct - this set of helpers depend on the data being ordered for there to be an efficient implementation. Since Set/HashSet don't have ordered data, we don't implement these for those.
|
@shoenig |
|
Hi @vanodevium, I just created a release for v0.1.12 BTW in case you are still interested in contributing, I also filed #45, #46, #47 for creating examples compatible with Go doc, which might be a nice place to get started |
This PR implements the following helper methods on
TreeSetBelow- set of elements strictly below a valueBelowEqual- set of elements below or equal to a valueFirstBelow- first element strictly below a value (if exists)FirstBelowEqual- first element below or equal to a value (if exists)Above- set of elements strictly above a valueAboveEqual- set of elements above or equal to a valueFirstAbove- first element strictly above a valueFirstAboveEqual- first element strictlyCloses #37
Closes #38