[][src]Function sorts::gnome_sort::gnome_sort

pub fn gnome_sort<T: PartialOrd>(s: &mut [T])

Sorts a slice in-place using gnome sort.

Gnome sort is also known as stupid sort, because it is very easy to understand and not very efficient. It is based on how a gnome would sort flower pots.

Examples

let mut vec = vec![5,3,2,4];
sorts::gnome_sort(&mut vec);
assert_eq!(vec, &[2,3,4,5]);