Fix formatting.
This commit is contained in:
parent
749bd0e2bc
commit
ce974b30c1
@ -1,12 +1,12 @@
|
||||
mod bst;
|
||||
mod stack;
|
||||
mod sort;
|
||||
mod stack;
|
||||
|
||||
use bst::BinarySearchTree;
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use rand::Rng;
|
||||
use bst::BinarySearchTree;
|
||||
use stack::Stack;
|
||||
use sort::bucket_sort;
|
||||
use stack::Stack;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Cli {
|
||||
|
@ -4,7 +4,10 @@ pub fn bucket_sort<T: Ord + Default + Copy, const SIZE: usize>(to_sort: &[T; SIZ
|
||||
// sort into buckets
|
||||
let mut buckets = BTreeMap::new();
|
||||
for item in to_sort {
|
||||
buckets.entry(item).and_modify(|count| *count += 1).or_insert(1);
|
||||
buckets
|
||||
.entry(item)
|
||||
.and_modify(|count| *count += 1)
|
||||
.or_insert(1);
|
||||
}
|
||||
|
||||
// Create new array, copying items to new array
|
||||
@ -19,4 +22,4 @@ pub fn bucket_sort<T: Ord + Default + Copy, const SIZE: usize>(to_sort: &[T; SIZ
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user