Skip to content

Permutation Algorithms #487

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

Merged
merged 3 commits into from
Apr 24, 2023
Merged

Permutation Algorithms #487

merged 3 commits into from
Apr 24, 2023

Conversation

aesteve
Copy link
Contributor

@aesteve aesteve commented Apr 23, 2023

Permutation Algorithms

Description

Adds a few common permutation algorithms:

  • the naive, recursive way, including a variant to avoid generating duplicates
  • Heap's algorithm
  • Steinhaus-Johnson-Trotter algorithm

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

Note: tests are running under 300ms on my laptop, let me know if it's too slow on CI. If so, we can definitely reduce MAX_SIZE to 6 or less.

@aesteve aesteve requested review from siriak and imp2002 as code owners April 23, 2023 16:11
@aesteve aesteve changed the title Heap algorithm Permutation Algorithms Apr 23, 2023
Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit 6c18723 into TheAlgorithms:master Apr 24, 2023
aesteve added a commit to aesteve/algorithms-in-rust that referenced this pull request Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants