All Algorithms implemented in Rust
382 matches across 4 categories. Click a row to expand file-level details.
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | src/data_structures/segment_tree_recursive.rs | 81 | /// |
| LOW | src/data_structures/segment_tree_recursive.rs | 121 | match (left_res, right_res) { |
| LOW | src/data_structures/fenwick_tree.rs | 21 | IndexOutOfBounds, |
| LOW | src/data_structures/fenwick_tree.rs | 41 | /// A new `FenwickTree` instance. |
| LOW | src/data_structures/fenwick_tree.rs | 101 | |
| LOW | src/data_structures/fenwick_tree.rs | 121 | let left_query = if left == 0 { |
| LOW | src/data_structures/fenwick_tree.rs | 161 | /// desired value and the current value, then applying that difference using `update`. |
| LOW | src/data_structures/fenwick_tree.rs | 181 | /// |
| LOW | src/data_structures/heap.rs | 1 | //! A generic heap data structure. |
| LOW | src/data_structures/heap.rs | 21 | |
| LOW | src/data_structures/heap.rs | 161 | } else { |
| LOW | src/data_structures/heap.rs | 221 | /// |
| LOW | src/data_structures/stack_using_singly_linked_list.rs | 101 | /// With the help of the ownership mechanism, the type `List` will be cleaned up automatically (dropped) after it goes o |
| LOW | src/data_structures/trie.rs | 1 | //! This module provides a generic implementation of a Trie (prefix tree). |
| LOW | src/data_structures/segment_tree.rs | 61 | } |
| LOW | src/data_structures/segment_tree.rs | 101 | left /= 2; |
| LOW | src/data_structures/range_minimum_query.rs | 1 | //! Range Minimum Query (RMQ) Implementation |
| LOW | src/data_structures/range_minimum_query.rs | 21 | } |
| LOW | src/data_structures/range_minimum_query.rs | 41 | /// A `RangeMinimumQuery` instance that can be used to perform range minimum queries. |
| LOW | src/data_structures/probabilistic/count_min_sketch.rs | 1 | use std::collections::hash_map::RandomState; |
| LOW | src/data_structures/probabilistic/count_min_sketch.rs | 21 | fn increment_by(&mut self, item: Self::Item, count: usize); |
| LOW | src/data_structures/probabilistic/count_min_sketch.rs | 41 | /// <- WIDTH = 5 -> |
| LOW | src/data_structures/probabilistic/count_min_sketch.rs | 61 | /// E hash2: [0, 1, 0, 0, 0] |
| LOW | src/data_structures/probabilistic/bloom_filter.rs | 1 | use std::collections::hash_map::{DefaultHasher, RandomState}; |
| LOW | src/data_structures/probabilistic/bloom_filter.rs | 81 | |
| LOW | src/bit_manipulation/swap_odd_even_bits.rs | 1 | /// Swaps odd and even bits in an integer. |
| LOW | src/bit_manipulation/swap_odd_even_bits.rs | 21 | /// assert_eq!(swap_odd_even_bits(2), 1); |
| LOW | src/bit_manipulation/find_unique_number.rs | 1 | /// Finds the unique number in a slice where every other element appears twice. |
| LOW | src/bit_manipulation/n_bits_gray_code.rs | 1 | /// Custom error type for Gray code generation. |
| LOW | src/bit_manipulation/reverse_bits.rs | 1 | //! This module provides a function to reverse the bits of a 32-bit unsigned integer. |
| LOW | src/bit_manipulation/reverse_bits.rs | 21 | //! O(1) - Uses a constant amount of extra space |
| LOW | src/bit_manipulation/reverse_bits.rs | 41 | /// A 32-bit unsigned integer with bits in reverse order |
| LOW | src/bit_manipulation/binary_coded_decimal.rs | 1 | //! Binary Coded Decimal (BCD) conversion |
| LOW | src/bit_manipulation/binary_coded_decimal.rs | 21 | /// |
| LOW | src/bit_manipulation/binary_coded_decimal.rs | 41 | /// |
| LOW | src/bit_manipulation/find_previous_power_of_two.rs | 1 | //! Previous Power of Two |
| LOW | src/bit_manipulation/find_previous_power_of_two.rs | 21 | /// |
| LOW | src/bit_manipulation/find_previous_power_of_two.rs | 41 | /// assert_eq!(find_previous_power_of_two(8).unwrap(), 8); |
| LOW | src/bit_manipulation/rightmost_set_bit.rs | 1 | /// Finds the index (position) of the rightmost set bit in a number. |
| LOW | src/bit_manipulation/rightmost_set_bit.rs | 21 | /// |
| LOW | src/bit_manipulation/sum_of_two_integers.rs | 1 | //! This module provides a function to add two integers without using the `+` operator. |
| LOW | src/bit_manipulation/find_missing_number.rs | 1 | /// Finds the missing number in a slice of consecutive integers. |
| LOW | src/bit_manipulation/highest_set_bit.rs | 1 | //! This module provides a function to find the position of the most significant bit (MSB) |
| LOW | src/bit_manipulation/counting_bits.rs | 1 | //! This module implements a function to count the number of set bits (1s) |
| LOW | src/bit_manipulation/twos_complement.rs | 1 | //! Two's Complement Representation |
| LOW | src/bit_manipulation/twos_complement.rs | 21 | /// A `Result` containing: |
| LOW | src/bit_manipulation/binary_count_trailing_zeros.rs | 1 | /// Counts the number of trailing zeros in the binary representation of a number |
| LOW | src/bit_manipulation/binary_count_trailing_zeros.rs | 21 | pub fn binary_count_trailing_zeros(num: u64) -> u32 { |
| LOW | src/bit_manipulation/hamming_distance.rs | 1 | //! Hamming Distance |
| LOW | src/bit_manipulation/hamming_distance.rs | 41 | /// |
| LOW | src/bit_manipulation/hamming_distance.rs | 61 | } |
| LOW | src/bit_manipulation/binary_shifts.rs | 1 | //! Binary Shift Operations |
| LOW | src/bit_manipulation/binary_shifts.rs | 21 | //! |
| LOW | src/bit_manipulation/binary_shifts.rs | 41 | /// |
| LOW | src/bit_manipulation/binary_shifts.rs | 61 | let zeros = "0".repeat(shift_amount as usize); |
| LOW | src/bit_manipulation/binary_shifts.rs | 81 | /// |
| LOW | src/bit_manipulation/binary_shifts.rs | 101 | } |
| LOW | src/bit_manipulation/binary_shifts.rs | 121 | /// ``` |
| LOW | src/bit_manipulation/binary_shifts.rs | 201 | /// # Arguments |
| LOW | src/bit_manipulation/is_power_of_two.rs | 1 | //! Power of Two Check |
| 265 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | src/financial/depreciation.rs | 427 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 429 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 435 | // ── Straight-line ──────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 23 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 25 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 63 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 65 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 84 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 86 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 137 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 139 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 205 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 207 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 282 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 284 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 348 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 350 | // ───────────────────────────────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 496 | // ── Diminishing balance ────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 537 | // ── Units-of-production ────────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 577 | // ── Sum-of-years' digits ───────────────────────────────── |
| MEDIUM | src/financial/depreciation.rs | 637 | // ── Double-declining balance ───────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 126 | // ── Initialisation ──────────────────────────────────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 206 | // ── Step: standard Adam (weight_decay = 0.0) ────────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 266 | // ── Step: AdamW (weight_decay > 0.0) ───────────────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 323 | // ── Step: shared edge cases ─────────────────────────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 332 | // ── Convergence (slow; marked #[ignore]) ───────────────────────────────── |
| MEDIUM | src/machine_learning/optimization/adam.rs | 332 | // ── Convergence (slow; marked #[ignore]) ───────────────────────────────── |
| MEDIUM | src/hashing/sha1.rs | 156 | // ── NIST FIPS 180-4 / RFC 3174 test vectors ────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 25 | // ── SHA-256 / SHA-224 ──────────────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 153 | // ── SHA-512 / SHA-384 / SHA-512/224 / SHA-512/256 ─────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 305 | // ── Tests ──────────────────────────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 323 | // ── Constant correctness ───────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 356 | // ── SHA-256 (FIPS 180-4) ───────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 394 | // ── SHA-224 (FIPS 180-4) ───────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 429 | // ── SHA-512 (FIPS 180-4) ───────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 468 | // ── SHA-384 (FIPS 180-4) ───────────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 504 | // ── SHA-512/256 (FIPS 180-4) ───────────────────────────────────────────── |
| MEDIUM | src/hashing/sha2.rs | 530 | // ── SHA-512/224 (FIPS 180-4) ───────────────────────────────────────────── |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | src/general/huffman_encoding.rs | 351 | "Lorem ipsum dolor sit amet, consectetur ", |
| LOW | src/general/huffman_encoding.rs | 351 | "Lorem ipsum dolor sit amet, consectetur ", |
| LOW | src/general/huffman_encoding.rs | 355 | "nullam vehicula. Interdum posuere lorem ipsum dolor. Elit eget ", |
| LOW | src/ciphers/base64.rs | 250 | test_e_d!(b"Lorem Ipsum sit dolor amet."); |
| LOW | src/ciphers/vigenere.rs | 59 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", |
| LOW | src/ciphers/vigenere.rs | 59 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", |
| LOW | src/ciphers/vigenere.rs | 69 | vigenere("1 Lorem ⏳ ipsum dolor sit amet Ѡ", "unicode"), |
| LOW | src/ciphers/vigenere.rs | 77 | vigenere("Lorem ipsum dolor sit amet", "😉 key!"), |
| LOW | src/ciphers/vigenere.rs | 77 | vigenere("Lorem ipsum dolor sit amet", "😉 key!"), |
| LOW | src/ciphers/vigenere.rs | 84 | assert_eq!(vigenere("Lorem ipsum", ""), "Lorem ipsum"); |
| LOW | src/string/z_algorithm.rs | 185 | "lorem ipsum dolor sit amet, consectetur ", |
| LOW | src/string/z_algorithm.rs | 185 | "lorem ipsum dolor sit amet, consectetur ", |
| LOW | src/string/z_algorithm.rs | 194 | "lorem ipsum dolor sit amet, consectetur ", |
| LOW | src/string/z_algorithm.rs | 194 | "lorem ipsum dolor sit amet, consectetur ", |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | src/data_structures/probabilistic/bloom_filter.rs | 54 | /// Can we improve it? Certainly, in different ways. |
| MEDIUM | …hine_learning/loss_function/mean_squared_error_loss.rs | 4 | //! robust loss function used in machine learning. |
| MEDIUM | …ine_learning/loss_function/mean_absolute_error_loss.rs | 4 | //! robust loss function used in machine learning. |
| MEDIUM | src/math/huber_loss.rs | 3 | //! The `huber_loss` function calculates the Huber loss, which is a robust loss function used in machine learning, parti |
| MEDIUM | src/math/huber_loss.rs | 18 | //! This implementation takes two references to vectors of f64 values, `actual` and `predicted`, and a `delta` value. It |