Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,16 @@
use std::cmp::{Ord, Eq};
fn jort_sort<T: Ord + Eq + Clone>(array: Vec<T>) -> bool {
// sort the array
let mut sorted_array = array.to_vec();
sorted_array.sort();
// compare to see if it was originally sorted
for i in 0..array.len() {
if array[i] != sorted_array[i] {
return false;
}
}
return true;
}

View file

@ -0,0 +1,12 @@
fn jort_sort<T>(slice: &[T]) -> bool
where
T: Ord + PartialEq + Clone,
{
let mut sorted = slice.to_vec();
sorted.sort_unstable();
slice
.iter()
.zip(sorted.iter())
.all(|(orig, sorted)| orig == sorted)
}

View file

@ -0,0 +1,9 @@
fn jort_sort<T>(slice: &[T]) -> bool
where
T: Ord + PartialEq + Clone,
{
let mut sorted = slice.to_vec();
sorted.sort_unstable();
slice == sorted
}