![]() |
AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
|
Iterator over all permutations of length n.
More...
Inheritance diagram for aud.util.PermutationIterator:
Collaboration diagram for aud.util.PermutationIterator:Public Member Functions | |
| PermutationIterator (int n) | |
| create new iterator More... | |
| boolean | hasNext () |
| int[] | next () |
| void | remove () |
Static Public Member Functions | |
| static void | main (String[] args) |
| demonstration and test More... | |
Iterator over all permutations of length n.
Permutations are represented as int[] arrays with entries 0,..,n-1.
Implementation inspired by std::next_permutation of the C++ standard library: assume ordered sequence and "count up" to lexicographically next sequence. (Requires only sequence as state.)
Definition at line 14 of file PermutationIterator.java.
create new iterator
| n | length of permutation |
Definition at line 30 of file PermutationIterator.java.
| boolean aud.util.PermutationIterator.hasNext | ( | ) |
Definition at line 38 of file PermutationIterator.java.
Referenced by aud.util.PermutationIterator.main().
Here is the caller graph for this function:
|
static |
demonstration and test
Definition at line 77 of file PermutationIterator.java.
References aud.util.PermutationIterator.hasNext().
Here is the call graph for this function:| int[] aud.util.PermutationIterator.next | ( | ) |
Definition at line 42 of file PermutationIterator.java.
| void aud.util.PermutationIterator.remove | ( | ) |
| UnsupportedOperationException |
Definition at line 72 of file PermutationIterator.java.