add ordinal indicator to the output

This commit is contained in:
jacekpoz 2024-05-08 20:09:47 +02:00
parent ee9e0a5af3
commit 49125ee428
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 14 additions and 2 deletions

View file

@ -48,7 +48,13 @@ fn main() -> io::Result<()> {
println!("end state: {:?}", list);
let mut insertion = InsertionSort::new(false);
println!("sorted array: {:?}", insertion.sort(&input_list));
println!("{} order statistic: {}", order_statistic, result);
let ordinal_indicator = match order_statistic {
1 => "st",
2 => "nd",
3 => "rd",
_ => "th",
};
println!("{}{} order statistic: {}", order_statistic, ordinal_indicator, result);
}
println!("swaps: {}", randomized.num_swap());

View file

@ -48,7 +48,13 @@ fn main() -> io::Result<()> {
println!("end state: {:?}", list);
let mut insertion = InsertionSort::new(false);
println!("sorted array: {:?}", insertion.sort(&input_list));
println!("{} order statistic: {}", order_statistic, result);
let ordinal_indicator = match order_statistic {
1 => "st",
2 => "nd",
3 => "rd",
_ => "th",
};
println!("{}{} order statistic: {}", order_statistic, ordinal_indicator, result);
}
println!("swaps: {}", normal.num_swap());