-
-
Notifications
You must be signed in to change notification settings - Fork 706
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
Add medianOfMedians #3938
Add medianOfMedians #3938
Conversation
43a1244 to
b1bed39
Compare
| assert(notGreater >= 0.3 * v.length); | ||
| assert(notSmaller >= 0.3 * v.length); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tests using std.internal.test.dummyrange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs tests that use a custom less
f70f461 to
72b2a7c
Compare
72b2a7c to
9e004c3
Compare
|
Awesome! This can be implemented for immutable ranges using a deep recursion. @andralex would you mind I create PR to your fork? |
|
I think I better get to implement the MoM with integrated partition first. Will get back to this. |
a0635de to
48080db
Compare
|
I'll reiterate my comments that were hidden due to the new commit:
|
…ianOfMediansPartition
48080db to
27cf1f4
Compare
|
@JackStouffer agreed, will get to that soon. For now performance is just awful. |
| private void medianOf5(alias less, Range)(Range r) | ||
| { | ||
| assert(r.length == 5); | ||
| enum : uint { a, b, c, d, e } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this enum feels strange, especially as there is nothing similar in the next function.
|
new work to come to this soon |
This is a famous and very elegant algorithm. In addition, the implementation is a beauty.