Struct std::slice::ElementSwapsExperimental
[-]
[+]
[src]
pub struct ElementSwaps { // some fields omitted }
An iterator that yields the element swaps needed to produce a sequence of all possible permutations for an indexed sequence of elements. Each permutation is only a single swap apart.
The Steinhaus-Johnson-Trotter algorithm is used.
Generates even and odd permutations alternately.
The last generated swap is always (0, 1), and it returns the sequence to its initial order.
Methods
impl ElementSwaps
fn new(length: uint) -> ElementSwaps
Creates an ElementSwaps
iterator for a sequence of length
elements.