JuliaMath / JuliaMath/Combinatorics.jl

Enumerating permutations in-place

Open
#114 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
230
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Hi there!

For one of my projects I wrote a small implementation of [Heap's algorithm](https://en.wikipedia.org/wiki/Heap%27s_algorithm), which iterates through all permutations of an array by shuffling its elements in-place. It does so in a way that minimizes the number of moves.

I think this would deserve a place in Combinatorics.jl, but I can't figure out how to provide a useful generic implementation. Enumerating permutations in-place is only good if you do something at each step, so I'm not sure a standard iterator is the right choice. Right now, I'm leaning towards accepting a function as argument, which would be applied after each move. What do you think?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.