All Questions
4 questions
2
votes
0
answers
124
views
Iterating over all simple unique cycles in an undirected graph in Java - brute-force approach
This post is about an Iterator iterating over simple loops of an undirected graph.
In the above graph, the cycle \$\langle 1, 2, 3, 4, 5, 3, 1 \rangle\$ is not ...
7
votes
1
answer
3k
views
An iterator returning all possible permutations of a list in Java
I have this class that iterates over all permutations of an input list:
PermutationIterable.java:
...
4
votes
2
answers
5k
views
Combination generator in Java - 2nd iteration
I have refactored the previous combination generator, and now it is an iterator returning combinations as lists. It hides larger constant factors as the previous version, yet it is really easy to use:
...
8
votes
1
answer
241
views
Scala implementation of @rolfl's integer-partitioning algorithm
While reviewing @Martijn's Distinct sums of integers (finding all combinations of positive integers that sum to a given number), I proposed the following solution:
...