Skip to content

Minimum/maximum elements search in BTreeMap/BTreeSet #31690

@abbradar

Description

@abbradar

It would be nice to have something like (pseudo-code):

fn BTreeMap<K, V>::find{Min,Max}(&self) -> Option<(&K, &V)>;
fn BTreeSet<K, V>::find{Min,Max}(&self) -> Option<&K>;

This should be fast for trees (just walk the tree to the left-most or right-most element) and is very useful. For example Haskell has these functions in its excellent library containers, along with other potentially interesting functions (see the whole "Min/Max" section).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions