Skip to content

Commit 59922a3

Browse files
committed
add directory
1 parent 4b04147 commit 59922a3

File tree

11 files changed

+14
-12
lines changed

11 files changed

+14
-12
lines changed

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
* [Word Break](https://github.com/TheAlgorithms/Rust/blob/master/src/dynamic_programming/word_break.rs)
106106
* Financial
107107
* [Present Value](https://github.com/TheAlgorithms/Rust/blob/master/src/financial/present_value.rs)
108+
* [Present Value](https://github.com/TheAlgorithms/Rust/blob/master/src/financial/black_scholes.rs)
108109
* General
109110
* [Convex Hull](https://github.com/TheAlgorithms/Rust/blob/master/src/general/convex_hull.rs)
110111
* [Fisher Yates Shuffle](https://github.com/TheAlgorithms/Rust/blob/master/src/general/fisher_yates_shuffle.rs)

output.txt

250 KB
Binary file not shown.

src/ciphers/diffie_hellman.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,7 @@ impl DiffieHellman {
228228
// Both parties now have the same shared secret key s which can be used for encryption or authentication.
229229

230230
pub fn new(group: Option<u8>) -> Self {
231-
let mut _group: u8 = 14;
232-
if let Some(x) = group {
233-
_group = x;
234-
}
231+
let _group = group.unwrap_or(14);
235232

236233
if !PRIMES.contains_key(&_group) {
237234
panic!("group not in primes")

src/ciphers/transposition.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ pub fn transposition(decrypt_mode: bool, msg: &str, key: &str) -> String {
4242

4343
key_ascii.sort_by_key(|&(index, _)| index);
4444

45-
for (_, key) in key_ascii
46-
.into_iter() { key_order.push(key.into()); }
45+
for (_, key) in key_ascii {
46+
key_order.push(key.into());
47+
}
4748

4849
// Determines whether to encrypt or decrypt the message,
4950
// and returns the result

src/data_structures/avl_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<T: Ord> AVLTree<T> {
100100
}
101101

102102
/// Returns an iterator that visits the values in the tree in ascending order.
103-
pub fn iter(&self) -> Iter<'_,T> {
103+
pub fn iter(&self) -> Iter<'_, T> {
104104
Iter {
105105
node_iter: self.node_iter(),
106106
}

src/data_structures/binary_search_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<T> BinarySearchTreeIter<'_, T>
188188
where
189189
T: Ord,
190190
{
191-
pub fn new(tree: &BinarySearchTree<T>) -> BinarySearchTreeIter<'_,T> {
191+
pub fn new(tree: &BinarySearchTree<T>) -> BinarySearchTreeIter<'_, T> {
192192
let mut iter = BinarySearchTreeIter { stack: vec![tree] };
193193
iter.stack_push_left();
194194
iter

src/data_structures/probabilistic/bloom_filter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub trait BloomFilter<Item: Hash> {
2222
/// If it's `false` it's absolutely sure the item isn't present
2323
/// If it's `true` the item may be present, or maybe another one produces the same hash
2424
#[derive(Debug)]
25+
#[allow(dead_code)]
2526
struct BasicBloomFilter<const CAPACITY: usize> {
2627
vec: [bool; CAPACITY],
2728
}

src/data_structures/treap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<T: Ord> Treap<T> {
8585
}
8686

8787
/// Returns an iterator that visits the nodes in the tree in order.
88-
fn node_iter(&self) -> NodeIter<'_,T> {
88+
fn node_iter(&self) -> NodeIter<'_, T> {
8989
let mut node_iter = NodeIter { stack: Vec::new() };
9090
// Initialize stack with path to leftmost child
9191
let mut child = &self.root;
@@ -97,7 +97,7 @@ impl<T: Ord> Treap<T> {
9797
}
9898

9999
/// Returns an iterator that visits the values in the tree in ascending order.
100-
pub fn iter(&self) -> Iter<'_,T> {
100+
pub fn iter(&self) -> Iter<'_, T> {
101101
Iter {
102102
node_iter: self.node_iter(),
103103
}

src/general/genetic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub trait SelectionStrategy<Rng: rand::Rng> {
3636

3737
/// A roulette wheel selection strategy
3838
/// https://en.wikipedia.org/wiki/Fitness_proportionate_selection
39+
#[allow(dead_code)]
3940
pub struct RouletteWheel<Rng: rand::Rng> {
4041
rng: Rng,
4142
}
@@ -84,6 +85,7 @@ impl<Rng: rand::Rng> SelectionStrategy<Rng> for RouletteWheel<Rng> {
8485
}
8586
}
8687

88+
#[allow(dead_code)]
8789
pub struct Tournament<const K: usize, Rng: rand::Rng> {
8890
rng: Rng,
8991
}

src/math/pollard_rho.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn pollard_rho_get_one_factor(number: u64, seed: &mut u32, check_is_prime: b
137137
fn get_small_factors(mut number: u64, primes: &[usize]) -> (u64, Vec<u64>) {
138138
let mut result: Vec<u64> = Vec::new();
139139
for p in primes {
140-
while !(number.is_multiple_of(*p as u64)) {
140+
while number.is_multiple_of(*p as u64) {
141141
number /= *p as u64;
142142
result.push(*p as u64);
143143
}

0 commit comments

Comments
 (0)