Skip to content

Add ability to pass in comparator instead of making keys implement Comparable #41

@rnikander

Description

@rnikander

Maybe I'm missing something, but it seems like with some algorithms there is an advantage to passing in the function that does the comparison. As an example, I'm computing line segment intersections with a sweep line algorithm. I wanted to try your BTree or SortedSet because my current data structure (a red black tree) seems slow. But it's difficult to use these classes because I need a comparison function that uses state from the algorithm: the sweep line, current point, etc. I can get around this by adding a reference to every single element in the SortedSet, but they were just integers, so that's at least doubled the storage needed per element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions