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