Skip to content

Conversation

@olivercalder
Copy link
Owner

No description provided.

Signed-off-by: Oliver Calder <oliver@calder.dev>
@olivercalder olivercalder self-assigned this Feb 13, 2025
@olivercalder olivercalder changed the title feat: add first draft of permutation generator feat: add permutations Feb 13, 2025
Signed-off-by: Oliver Calder <oliver@calder.dev>
In the future, it may be desirable to use a header/footer and get rid of
the `Option<>` wrappers around `prev` and `next`, but the status quo was
a middle ground where the use of `Option<>` made we were checking for
`prev` to be not `None` anyway, so it's easy enough to use an explicit
head, and we were in a painful middle ground.

Additionally, added more doctests for other permutation variants (all
lengths and specified length.

Signed-off-by: Oliver Calder <oliver@calder.dev>
@olivercalder
Copy link
Owner Author

TODO: define custom type to replace Option<usize> which uses 2^64-1 as None, so there's no need to use twice the memory just to store optional integers.

Thanks for the suggestion @paul-rodriguez !

@olivercalder
Copy link
Owner Author

It would also be nice to turn the AvailableList into a trait which supports first() and swap_for_next() methods, and using the current backend as well as a bitset implementation as Paul suggested. We could then benchmark the two implementations with element lists of some huge size (~1 billion?) and permutation lengths of 1, N/2, and N. This would be way too slow at 1 billion, but perhaps we could find a way to benchmark and compare these anyway.

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