boostorg / boostorg/heap

Enhance usability for finding k-maximum (minimum) values in set

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
20
Forks
44
PR merge metrics
No merged PRs in 30d

Description

My chief use case for a heap is finding the k-maximum (minimum) members of a set, but the update methods (`update`, `increase`, and `decrease`) cannot be easily used for this because they take a `handle_type` which cannot be easily acquired for the top element. Using `heap::ordered_begin()` does not work because there is no direct route from an `ordered_iterator` to a `handle` like in `s_handle_from_iterator`.

I propose

1. overloading `s_handle_from_iterator` to accept `ordered_iterator`,
2. providing access to the top element as a handle, e.g. `handle_type top_element_handle();`, and
3. possibly adding update methods that act directly on the top element, e.g. `void update_top(const_reference)`, etc.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the heap update methods (`update`, `increase`, and `decrease`), `ordered_begin()`, and `s_handle_from_iterator` to understand the existing iterator and handle APIs. Resolve which proposed top-element or ordered-iterator access is wanted, then verify that the chosen API supports finding and updating k-maximum or k-minimum values as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.