Sorting algorithms/Gnome sort: Difference between revisions
m
Rust - replace Ord by PartialOrd
(Added Wren) |
m (Rust - replace Ord by PartialOrd) |
||
Line 2,637:
=={{header|Rust}}==
<lang rust>fn gnome_sort<T:
let len = a.len();
let mut i
let mut j
while i < len {
if a[i - 1] <= a[i] {
Line 2,646:
i = j;
j += 1;
} else {
a.swap(i - 1, i);
i -= 1;
|