How to search C5.TreeSet?

232 Views Asked by At

I have a C5.TreeSet<double>, a sorted data structure. https://github.com/sestoft/C5/

Given a value x, I'd like to search the set S for the greatest index i such S[j] <= x for all j ≤ i (similar to Python's bisect.bisect). How can I do that?

I was previously using List<T> with BinarySearch

1

There are 1 best solutions below

1
On BEST ANSWER

When S is a TreeSet, or more generally, an IIndexedSorted, then S.CountTo(x) will give you the number of items strictly less than x.