add ordinal indicator to the output
This commit is contained in:
parent
ee9e0a5af3
commit
49125ee428
2 changed files with 14 additions and 2 deletions
|
@ -48,7 +48,13 @@ fn main() -> io::Result<()> {
|
||||||
println!("end state: {:?}", list);
|
println!("end state: {:?}", list);
|
||||||
let mut insertion = InsertionSort::new(false);
|
let mut insertion = InsertionSort::new(false);
|
||||||
println!("sorted array: {:?}", insertion.sort(&input_list));
|
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());
|
println!("swaps: {}", randomized.num_swap());
|
||||||
|
|
|
@ -48,7 +48,13 @@ fn main() -> io::Result<()> {
|
||||||
println!("end state: {:?}", list);
|
println!("end state: {:?}", list);
|
||||||
let mut insertion = InsertionSort::new(false);
|
let mut insertion = InsertionSort::new(false);
|
||||||
println!("sorted array: {:?}", insertion.sort(&input_list));
|
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());
|
println!("swaps: {}", normal.num_swap());
|
||||||
|
|
Loading…
Reference in a new issue