Function sort_steps::cocktail_sort
source · pub fn cocktail_sort<T>(v: &[T]) -> impl Iterator<Item = Vec<T>>where
T: Clone + PartialOrd,Expand description
Sorts a slice of data using the cocktail sort algorithm.
Examples
let numbers = [5, 9, 3, 6, 8, 2, 1, 7, 4];
println!("Cocktail Sort Steps:");
for (i, v) in cocktail_sort(&numbers).enumerate() {
println!("#{:02}: {:?}", i, v);
}