From 916364d5ec4456bbc5a37fdaf58dd4d69688af23 Mon Sep 17 00:00:00 2001 From: Jay Pokale <99467494+JayPokale@users.noreply.github.com> Date: Sun, 6 Dec 2026 13:39:15 +0530 Subject: [PATCH] chore: fix typos in comments --- src/ciphers/diffie_hellman.rs | 2 +- src/data_structures/linked_list.rs | 2 +- src/general/kmeans.rs | 6 +++--- src/graph/decremental_connectivity.rs | 6 +++--- src/math/amicable_numbers.rs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ciphers/diffie_hellman.rs b/src/ciphers/diffie_hellman.rs index d749b3c4081..83c8c563174 100644 --- a/src/ciphers/diffie_hellman.rs +++ b/src/ciphers/diffie_hellman.rs @@ -332,7 +332,7 @@ mod tests { let _bob_private = bob.get_private_key(); let bob_public = bob.generate_public_key(); - // generating shared key using the struct implemenations + // generating shared key using the struct implementations let alice_shared = alice.generate_shared_key(bob_public.as_str()).unwrap(); let bob_shared = bob.generate_shared_key(alice_public.as_str()).unwrap(); assert_eq!(alice_shared, bob_shared); diff --git a/src/data_structures/linked_list.rs b/src/data_structures/linked_list.rs index 5f782d82967..513e264757f 100644 --- a/src/data_structures/linked_list.rs +++ b/src/data_structures/linked_list.rs @@ -362,7 +362,7 @@ mod tests { assert_eq!(list.length, 100); - // Ensure numbers were adderd back and we're able to traverse nodes + // Ensure numbers were added back and we're able to traverse nodes if let Some(val) = list.get(78) { assert_eq!(*val, 78); } else { diff --git a/src/general/kmeans.rs b/src/general/kmeans.rs index 54022c36dd7..e5c55832525 100644 --- a/src/general/kmeans.rs +++ b/src/general/kmeans.rs @@ -67,9 +67,9 @@ macro_rules! impl_kmeans { pub fn kmeans(xs: Vec>, k: usize) -> Vec { assert!(xs.len() >= k); - // Rather than pulling in a dependency to radomly select the staring - // points for the centroids, we're going to deterministally choose them by - // slecting evenly spaced points in `xs` + // Rather than pulling in a dependency to randomly select the staring + // points for the centroids, we're going to deterministically choose them by + // selecting evenly spaced points in `xs` let n_per_cluster: usize = xs.len() / k; let centroids: Vec> = (0..k).map(|j| xs[j * n_per_cluster].clone()).collect(); diff --git a/src/graph/decremental_connectivity.rs b/src/graph/decremental_connectivity.rs index e5245404866..a8de480eeb9 100644 --- a/src/graph/decremental_connectivity.rs +++ b/src/graph/decremental_connectivity.rs @@ -1,10 +1,10 @@ use std::collections::HashSet; /// A data-structure that, given a forest, allows dynamic-connectivity queries. -/// Meaning deletion of an edge (u,v) and checking whether two vertecies are still connected. +/// Meaning deletion of an edge (u,v) and checking whether two vertices are still connected. /// /// # Complexity -/// The preprocessing phase runs in O(n) time, where n is the number of vertecies in the forest. +/// The preprocessing phase runs in O(n) time, where n is the number of vertices in the forest. /// Deletion runs in O(log n) and checking for connectivity runs in O(1) time. /// /// # Sources @@ -162,7 +162,7 @@ fn has_cycle( mod tests { use std::collections::HashSet; - // test forest (remember the assumptoin that roots are adjacent to themselves) + // test forest (remember the assumption that roots are adjacent to themselves) // _ _ // \ / \ / // 0 7 diff --git a/src/math/amicable_numbers.rs b/src/math/amicable_numbers.rs index 35ff4d7fcfe..d70807b9567 100644 --- a/src/math/amicable_numbers.rs +++ b/src/math/amicable_numbers.rs @@ -1,5 +1,5 @@ // Operations based around amicable numbers -// Suports u32 but should be interchangable with other types +// Supports u32 but should be interchangable with other types // Wikipedia reference: https://en.wikipedia.org/wiki/Amicable_numbers // Returns vec of amicable pairs below N