MCPcopy Create free account

hub / github.com/TheAlgorithms/Rust / functions

Functions2,908 in github.com/TheAlgorithms/Rust

↓ 2 callersFunctionbytes_to_word
Take arbitrarily long slice of u8's and turn up to 8 bytes into u64
src/hashing/blake2b.rs:166
↓ 2 callersFunctionbytes_to_word
(bytes: &[Byte])
src/ciphers/aes.rs:436
↓ 2 callersFunctioncalculate_max_values
Determines the maximum heights from either direction in the elevation map. # Arguments `elevation_map` - A slice representing the heights of the ter
src/dynamic_programming/trapped_rainwater.rs:35
↓ 2 callersMethodcalculate_route_distance
Calculate the total distance of a route
src/graph/ant_colony_optimization.rs:166
↓ 2 callersMethodcapacity
(&self)
src/math/bell_numbers.rs:54
↓ 2 callersFunctionceil
(dividend: usize, divisor: usize)
src/hashing/blake2b.rs:57
↓ 2 callersFunctioncenter_data
Center the data by subtracting the mean from each feature
src/machine_learning/principal_component_analysis.rs:30
↓ 2 callersFunctionchar_count
Computes the histogram of characters in a string. # Arguments `s` - Input string. # Returns A `HashMap` where the keys are characters and values a
src/string/anagram.rs:61
↓ 2 callersFunctionchar_to_value
Helper function to convert a Roman numeral character to its integer value. # Arguments `ch` - A Roman numeral character (I, V, X, L, C, D, M) # Ret
src/conversions/roman_numerals.rs:183
↓ 2 callersFunctioncheck_keys
Validates the encryption/decryption keys. # Arguments `key_a` - The multiplicative key `key_b` - The additive key `is_encrypt` - Whether this is for
src/ciphers/affine_cipher.rs:106
↓ 2 callersFunctioncheck_mapping
Checks the mapping between two characters and updates the map. # Arguments `map` - The HashMap to store the mapping. `key` - The key character. `val
src/string/isomorphism.rs:46
↓ 2 callersFunctionclean_string
Cleans the input string by removing spaces and converting to lowercase. Returns an error if any non-alphabetic character is found. # Arguments `s` -
src/string/anagram.rs:39
↓ 2 callersFunctioncompute_hash
Calculates the hash of a string using the Rabin-Karp formula. # Arguments `s` - The string to calculate the hash for. # Returns The hash value of th
src/string/rabin_karp.rs:51
↓ 2 callersFunctioncompute_means
Principal Component Analysis (PCA) for dimensionality reduction. PCA transforms data to a new coordinate system where the greatest variance lies on th
src/machine_learning/principal_component_analysis.rs:7
↓ 2 callersFunctionconvert_temperature
(value: f64, from: TemperatureUnit, to: TemperatureUnit)
src/conversions/temperature.rs:53
↓ 2 callersFunctionconvert_volume
Convert a volume value from one unit to another # Examples ``` use the_algorithms_rust::conversions::{convert_volume, VolumeUnit}; let liters = con
src/conversions/volume.rs:185
↓ 2 callersFunctionconvert_weight
Convert weight from one unit to another. This function accepts both `WeightUnit` enums and string identifiers. # Arguments `value` - The numerical
src/conversions/weight.rs:287
↓ 2 callersFunctioncotan
Cotangent of angle 'x' in radians, calculated with the given tolerance
src/math/trig_functions.rs:115
↓ 2 callersFunctioncounting_sort
In place counting sort for collections of u32 O(n + maxval) in time, where maxval is the biggest value an input can possibly take O(maxval) in memory
src/sorting/counting_sort.rs:6
↓ 2 callersMethodcross_prod
(&self, other: &Point)
src/geometry/point.rs:21
↓ 2 callersFunctiondecision_tree
Convenience function to train a decision tree and make predictions
src/machine_learning/decision_tree.rs:337
↓ 2 callersMethoddecompose_tree
(&mut self, adj: &Adj)
src/graph/centroid_decomposition.rs:100
↓ 2 callersMethoddecrypt
Decrypts the given text using the Hill cipher.
src/ciphers/hill_cipher.rs:255
↓ 2 callersMethoddelete_tail
(&mut self)
src/data_structures/linked_list.rs:131
↓ 2 callersFunctionderivative
(params: &[f64], data_points: &[(Vec<f64>, f64)])
src/machine_learning/logistic_regression.rs:24
↓ 2 callersMethoddfs
(&mut self, v: usize, pushed: T)
src/graph/dinic_maxflow.rs:106
↓ 2 callersFunctiondiminishing_balance_depreciation
Calculates depreciation using the **diminishing balance** (declining balance) method. A fixed `rate` (0 < rate ≤ 1) is applied each year to the *rema
src/financial/depreciation.rs:172
↓ 2 callersMethoddistance_to
Calculate Euclidean distance to another city
src/graph/ant_colony_optimization.rs:29
↓ 2 callersFunctiondouble_to_int
(amount: f64)
src/math/trial_division.rs:6
↓ 2 callersMethoddrain
Clears all elements from the queue
src/data_structures/queue.rs:52
↓ 2 callersFunctiondutch_national_flag_sort
Algorithm implementation
src/sorting/dutch_national_flag_sort.rs:17
↓ 2 callersMethodencrypt
Encrypts the given text using the Hill cipher.
src/ciphers/hill_cipher.rs:205
↓ 2 callersFunctionencrypt_part
Arranges the trigram value of each letter of message_part vertically and joins them horizontally.
src/ciphers/trifid.rs:90
↓ 2 callersFunctionengage_man
( man: &str, woman: &str, free_men: &mut VecDeque<String>, current_partner: &mut HashMap<Strin
src/greedy/stable_matching.rs:88
↓ 2 callersMethodenqueue
Adds an element to the back of the queue
src/data_structures/queue.rs:22
↓ 2 callersFunctioneq_s
boilerplate, because `==` isn't `const` yet
src/searching/moore_voting.rs:45
↓ 2 callersFunctioneuclidean_distance
(vector_1: &Vector, vector_2: &Vector)
src/math/euclidean_distance.rs:5
↓ 2 callersMethodexponent
Returns the exponent (power of 10) for this unit relative to meters. # Example ``` use the_algorithms_rust::conversions::MetricLengthUnit; assert_e
src/conversions/order_of_magnitude_conversion.rs:76
↓ 2 callersFunctionf64_cmp
(a: &f64, b: &f64)
src/geometry/closest_points.rs:12
↓ 2 callersMethodfind
Returns the root index of the set containing the given value, or `None` if it doesn't exist.
src/data_structures/union_find.rs:42
↓ 2 callersMethodfind_maxflow
(&mut self, infinite_flow: T)
src/graph/dinic_maxflow.rs:134
↓ 2 callersFunctionfind_previous_power_of_two
Previous Power of Two This module provides a function to find the largest power of two that is less than or equal to a given non-negative integer. #
src/bit_manipulation/find_previous_power_of_two.rs:53
↓ 2 callersMethodfind_words
(&self, prefix: &str)
src/string/autocomplete_using_trie.rs:85
↓ 2 callersFunctionfloor
(value: f64, scale: u8)
src/math/trial_division.rs:1
↓ 2 callersFunctionfrom_block
(block: u64)
src/ciphers/tea.rs:88
↓ 2 callersFunctiong
(v: &mut [Word; 16], a: usize, b: usize, c: usize, d: usize, x: Word, y: Word)
src/hashing/blake2b.rs:61
↓ 2 callersFunctiongcd
(mut a: u64, mut b: u64)
src/math/pollard_rho.rs:27
↓ 2 callersFunctiongcd
Computes the greatest common divisor using Euclid's algorithm # Arguments `a` - First number `b` - Second number # Returns The GCD of `a` and `b`
src/ciphers/rsa_cipher.rs:47
↓ 2 callersMethodgenerate_public_key
Generate public key A = g**a mod p
src/ciphers/diffie_hellman.rs:254
↓ 2 callersFunctiongenerate_repeated_elements_vec
(n: u32, unique_elements: u8)
src/sorting/sort_utils.rs:51
↓ 2 callersMethodgenerate_shared_key
Generate the shared key
src/ciphers/diffie_hellman.rs:280
↓ 2 callersMethodget
(&self, n: usize)
src/math/bell_numbers.rs:35
↓ 2 callersMethodget_64bits
(&mut self)
src/math/pollard_rho.rs:22
↓ 2 callersFunctionget_discover_time
(vertex_state: u64)
src/graph/strongly_connected_components.rs:49
↓ 2 callersFunctionget_distance
(p1: &(f64, f64), p2: &(f64, f64))
src/machine_learning/k_means.rs:3
↓ 2 callersFunctionget_matched_characters
(s1: &str, s2: &str)
src/string/jaro_winkler_distance.rs:11
↓ 2 callersMethodget_private_key
get private key as hexadecimal String
src/ciphers/diffie_hellman.rs:249
↓ 2 callersFunctiongraph1
Example graph #1: * * (1) <--- Root * / \ * (2) (3) * / | | \ * (4) (5
src/graph/breadth_first_search.rs:109
↓ 2 callersFunctiongraph2
Example graph #2: * * (1) --- (2) (3) --- (4) * / | / / * / | / / * /
src/graph/breadth_first_search.rs:153
↓ 2 callersFunctionheapify
(arr: &mut [T], n: usize, i: usize)
src/sorting/intro_sort.rs:14
↓ 2 callersMethodheapify_down
Moves an element downwards to restore the heap property. # Parameters - `idx`: The index of the element to heapify down.
src/data_structures/heap.rs:126
↓ 2 callersMethodheight
Returns the height of the maze. # Returns The height of the maze.
src/backtracking/rat_in_maze.rs:103
↓ 2 callersMethodincrement_by
(&mut self, item: Self::Item, count: usize)
src/data_structures/probabilistic/count_min_sketch.rs:128
↓ 2 callersMethodinsert
Inserts value into the tree.
src/data_structures/veb_tree.rs:89
↓ 2 callersMethodinsert_empty
(&mut self, value: u32)
src/data_structures/veb_tree.rs:82
↓ 2 callersMethodinto_pressure_unit
(self)
src/conversions/pressure.rs:20
↓ 2 callersMethodinto_weight_unit
(self)
src/conversions/weight.rs:45
↓ 2 callersMethodinverse
(self)
src/math/field.rs:148
↓ 2 callersFunctionipv4_to_decimal
Convert an IPv4 address to its decimal representation. The conversion is performed by treating each octet as 8 bits and combining them into a 32-bit
src/conversions/ipv4_conversion.rs:54
↓ 2 callersMethodis_in_decomposition
(&self, v: usize)
src/graph/centroid_decomposition.rs:44
↓ 2 callersMethodis_maxed_out
(&self, node: &Node<T>)
src/data_structures/b_tree.rs:54
↓ 2 callersFunctionis_mersenne_prime
mersenne prime : https://en.wikipedia.org/wiki/Mersenne_prime
src/math/mersenne_primes.rs:2
↓ 2 callersMethodis_safe
Checks if the given position is safe to move to. # Arguments `x` - The x-coordinate of the position. `y` - The y-coordinate of the position. # Retu
src/backtracking/knight_tour.rs:82
↓ 2 callersFunctionis_unvisited
(vertex_state: u64)
src/graph/strongly_connected_components.rs:44
↓ 2 callersFunctionis_valid_nonnegative
(num: &str)
src/big_integer/multiply.rs:28
↓ 2 callersMethoditer
(&self)
src/data_structures/rb_tree.rs:223
↓ 2 callersFunctionkey_expansion
(init_key: &[Byte], num_rounds: usize)
src/ciphers/aes.rs:292
↓ 2 callersFunctionlegendre_symbol
The Legendre symbol `(a | p)` Returns 0 if a = 0 mod p, 1 if a is a square mod p, -1 if it not a square mod p. <https://en.wikipedia.org/wiki/Legend
src/math/quadratic_residue.rs:80
↓ 2 callersFunctionlinear_interpolation
In mathematics, linear interpolation is a method of curve fitting using linear polynomials to construct new data points within the range of a discrete
src/math/interpolation.rs:6
↓ 2 callersFunctionlowbit
Computes the lowest set bit (rightmost `1` bit) of a number. This function isolates the lowest set bit in the binary representation of `x`. It's used
src/data_structures/fenwick_tree.rs:194
↓ 2 callersFunctionmask_128
Given a value and a hash function, compute the hash and return the bit mask
src/data_structures/probabilistic/bloom_filter.rs:70
↓ 2 callersFunctionmatch_with_z_array
Matches the occurrences of a pattern in an input string starting from a specified index. # Parameters - `input_string`: A slice of elements to search
src/string/z_algorithm.rs:81
↓ 2 callersFunctionmatrix_multiply
(multiplier: &[Vec<u128>], multiplicand: &[Vec<u128>])
src/dynamic_programming/fibonacci.rs:156
↓ 2 callersFunctionmerge
(arr: &mut [T], mid: usize)
src/sorting/merge_sort.rs:1
↓ 2 callersFunctionmiller_rabin
(number: u64, bases: &[u64])
src/math/miller_rabin.rs:38
↓ 2 callersFunctionmin_opt
(a: &Option<T>, b: &Option<T>)
src/sorting/tournament_sort.rs:57
↓ 2 callersFunctionmix_column_blocks
(data: &mut [Byte], mode: AesMode)
src/ciphers/aes.rs:342
↓ 2 callersFunctionmod_inverse
Computes the modular multiplicative inverse using the Extended Euclidean Algorithm Finds `x` such that `(a * x) % m == 1` # Arguments `a` - The num
src/ciphers/rsa_cipher.rs:68
↓ 2 callersFunctionmod_pow
Performs modular exponentiation: (base^exp) % modulus Uses the square-and-multiply algorithm for efficiency # Arguments `base` - The base number `e
src/ciphers/rsa_cipher.rs:102
↓ 2 callersMethodnext
(&mut self)
src/data_structures/treap.rs:264
↓ 2 callersMethodnext
(&mut self)
src/math/pollard_rho.rs:18
↓ 2 callersMethodnode_iter
Returns an iterator that visits the nodes in the tree in order.
src/data_structures/treap.rs:88
↓ 2 callersMethodnode_iter
Returns an iterator that visits the nodes in the tree in order.
src/data_structures/avl_tree.rs:88
↓ 2 callersFunctionnormalize
(mut a: String, n: usize)
src/math/karatsuba_multiplication.rs:37
↓ 2 callersMethodnum_parents
(&self, v: usize)
src/graph/lowest_common_ancestor.rs:33
↓ 2 callersMethodnum_vertices
Returns the number of vertices in the graph.
src/backtracking/graph_coloring.rs:73
↓ 2 callersMethodon_segment
(&self, p: &Point)
src/geometry/segment.rs:71
↓ 2 callersFunctionpad
Pads the message to a multiple of 512 bits. SHA-1 padding appends a single `1` bit, enough `0` bits, and finally the original message length as a 64-
src/hashing/sha1.rs:54
↓ 2 callersFunctionpartition
(list: &mut [i32], left: usize, right: usize, pivot_index: usize)
src/searching/quick_select.rs:3
↓ 2 callersFunctionpartition
(m: i32)
src/dynamic_programming/integer_partition.rs:37
← previousnext →301–400 of 2,908, ranked by callers