pub trait Bogosort<T: PartialEq + PartialOrd + Clone + Copy> {
fn bogosort(&mut self);
fn bogosort_timed(&mut self) -> Duration;
fn bogosort_stepped(&mut self) -> Vec<Vec<T>>;
fn bogosort_stepped_and_timed(&mut self) -> (Vec<Vec<T>>, Duration);
}
Expand description
A trait providing the bogosort method.
Required methods
fn bogosort_timed(&mut self) -> Duration
fn bogosort_timed(&mut self) -> Duration
The bogosort algorithm but timed.
Sorts the Vec
it is called on and returns the Duration
of the process – or dies trying.
fn bogosort_stepped(&mut self) -> Vec<Vec<T>>
fn bogosort_stepped(&mut self) -> Vec<Vec<T>>
The bogosort algorithm but stepped.
Sorts the Vec
it is called on and returns a Vec
containing each step of the process
– or dies trying.
Implementations on Foreign Types
sourceimpl<T> Bogosort<T> for Vec<T> where
T: PartialEq + PartialOrd + Clone + Copy,
impl<T> Bogosort<T> for Vec<T> where
T: PartialEq + PartialOrd + Clone + Copy,
The trait implementation of the bogosort algorithm.