[][src]Trait sorting::Bogosort

pub trait Bogosort {
    fn bogosort(&mut self);
}

This trait provides the bogosort functionality.

Required methods

fn bogosort(&mut self)

Bogosort or random sort is a highly ineffective sorting algorithm based on the "generate and test" paradigm. The sorting function permutes its input and then checks whether the generated sequence is correctly ordered.

If not, a new permutation is generated:

while not isInOrder(deck):
    shuffle(deck)

The permutations can either be enumerated in order to avoid duplicates or completely randomized.

Loading content...

Implementations on Foreign Types

impl<T: PartialOrd> Bogosort for Vec<T>[src]

The trait implementation for the Vec<T> type is based on the randomized approach that randomly permutes the function input.

Loading content...

Implementors

Loading content...