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

nthPermutation #5068

Merged
merged 2 commits into from
Nov 12, 2018
Merged

nthPermutation #5068

merged 2 commits into from
Nov 12, 2018

Conversation

burner
Copy link
Member

@burner burner commented Jan 24, 2017

sorts a given range in constant time into its nth permutation. Using the factorial number system and Lehmer codes

@wilzbach
Copy link
Member

CircleCi fails due to style checks:

Enforce Allman style
grep -nrE '(if|for|foreach|foreach_reverse|while|unittest|switch|else|version) .*{$' $(find . -name '*.d'); test $? -eq 1
./std/algorithm/sorting.d:4709:pure @safe unittest {

@wilzbach wilzbach added this to the 2.075.0 milestone Mar 4, 2017
@burner burner force-pushed the nthPermutation branch from f6ca47c to f66b06e Compare May 2, 2017 12:21
@burner burner force-pushed the nthPermutation branch from f66b06e to 7d7ef5a Compare May 4, 2017 08:12
@burner
Copy link
Member Author

burner commented May 4, 2017

@quickfur are you at dconf?

@quickfur
Copy link
Member

quickfur commented May 4, 2017

Sadly, no. :-(

@burner burner requested a review from andralex May 7, 2017 08:38
@burner
Copy link
Member Author

burner commented May 7, 2017

@andralex this contains a new public symbol

@andralex andralex removed the @andralex label Jun 3, 2017
@andralex
Copy link
Member

andralex commented Jun 3, 2017

Name addition is okay.

@burner burner force-pushed the nthPermutation branch 2 times, most recently from d4c80f9 to 7d0d584 Compare June 14, 2017 09:23
@MartinNowak MartinNowak removed this from the 2.075.0 milestone Jun 25, 2017
@burner burner added this to the 2.076.0 milestone Jun 30, 2017
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @burner!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#5068"

@burner
Copy link
Member Author

burner commented May 4, 2018

ping @andralex @wilzbach @JackStouffer

Copy link
Member

@JackStouffer JackStouffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still believe that decimalToFactorial should go to std.numeric

@burner burner force-pushed the nthPermutation branch from c641f85 to b09ac62 Compare May 4, 2018 15:48
@burner burner force-pushed the nthPermutation branch 2 times, most recently from d9766f8 to 0fef146 Compare June 21, 2018 10:01
@burner
Copy link
Member Author

burner commented Jun 21, 2018

finally found some time to move decimalToFactorial to numeric.

@wilzbach @JackStouffer @andralex can we move on this now?

@burner burner force-pushed the nthPermutation branch 3 times, most recently from 988833b to 7496765 Compare June 21, 2018 11:58
add the function nthPermutation that permutates a given range in place n
permutations in O(1).

This is O(n - 1) steps faster than calling nextPermutation n times.
@thewilsonator
Copy link
Contributor

Moving on.

@burner
Copy link
Member Author

burner commented Nov 12, 2018

@thewilsonator thank you

@thewilsonator thewilsonator dismissed stale reviews from JackStouffer, andralex, and UplinkCoder November 12, 2018 11:32

comments addressed

@thewilsonator thewilsonator merged commit a05af05 into dlang:master Nov 12, 2018
@thewilsonator
Copy link
Contributor

No problems

@burner burner deleted the nthPermutation branch November 12, 2018 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants