Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: analog of C++'s std::nth_element for rust slices. #55300

Open
Mokosha opened this issue Oct 24, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@Mokosha
Copy link
Contributor

commented Oct 24, 2018

This is the tracking bug for the discussion outlined in rust-lang/rfcs#1470.

I'm working on implementing this in the libstd, and will add it as an unstable feature pending resolution of any comments that may arise in this thread. I plan to add comprehensive testing as well.

@nikic

This comment has been minimized.

Copy link
Contributor

commented Oct 24, 2018

Just for the record, if someone needs this functionality right now, the order_stat crate provides an implementation of the Floyd-Rivest selection algorithm.

Centril added a commit to Centril/rust that referenced this issue Jan 23, 2019

Rollup merge of rust-lang#55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug rust-lang#55300.

bors added a commit that referenced this issue Jan 23, 2019

Auto merge of #55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug #55300.

bors added a commit that referenced this issue Mar 11, 2019

Auto merge of #55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug #55300.

bors added a commit that referenced this issue Apr 2, 2019

Auto merge of #55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug #55300.
@scottmcm

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

A thought: since we have sort and sort_unstable, should the method that got implemented be partition_unstable_at_index instead? Though I suppose there's no good stable way to do it...

Centril added a commit to Centril/rust that referenced this issue Apr 2, 2019

Rollup merge of rust-lang#55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug rust-lang#55300.

Centril added a commit to Centril/rust that referenced this issue Apr 3, 2019

Rollup merge of rust-lang#55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug rust-lang#55300.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.