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