-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Heaps algorithm iterative #2505
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
Heaps algorithm iterative #2505
Conversation
>>> from itertools import permutations | ||
>>> sorted(heaps([1,2,3])) == sorted(permutations([1,2,3])) | ||
True | ||
""" |
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.
""" | |
>>> all(sorted(heaps(x)) == sorted(permutations(x)) for x in ([], [0], [-1, 1], [1, 2, 3])) | |
True | |
""" |
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.
Then I think we are ready to land this one.
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.
Modified the iterative version as well as the recursive one (#2475 ) with your suggestion.
Thanks for reviewing ! 👍
Edit: I see there is a problem with pytest but looks like you're working on it so i leave it like that for now.
Hey @grochedix, TravisCI finished with status TravisBuddy Request Identifier: 48073680-01b6-11eb-9be6-0d9634a5fbe7 |
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.
LGTM
* heap's algorithm iterative * doctest * doctest * rebuild
* heap's algorithm iterative * doctest * doctest * rebuild
Describe your change:
Iterative Heap's algorithm.
Checklist:
Fixes: #{$ISSUE_NO}
.