Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TheAlgorithms/Rust
/ functions
Functions
2,908 in github.com/TheAlgorithms/Rust
⨍
Functions
2,908
◇
Types & classes
211
↓ 4 callers
Function
prequel_memes_tree
()
src/data_structures/binary_search_tree.rs:228
↓ 4 callers
Method
priority
Returns the priority of the left or right subtree.
src/data_structures/treap.rs:190
↓ 4 callers
Function
prufer_decode
(code: &[V], vertex_list: &[V])
src/graph/prufer_code.rs:44
↓ 4 callers
Method
rebalance
Performs left or right tree rotations to balance this node.
src/data_structures/avl_tree.rs:237
↓ 4 callers
Function
replace_node
( tree: &mut RBTree<K, V>, parent: *mut RBNode<K, V>, node: *mut RBNode<K, V>, new: *mut RBNod
src/data_structures/rb_tree.rs:578
↓ 4 callers
Function
rhumb_dist
(lat1: f64, long1: f64, lat2: f64, long2: f64)
src/navigation/rhumbline.rs:5
↓ 4 callers
Function
selection_sort
(arr: &mut [T])
src/sorting/selection_sort.rs:1
↓ 4 callers
Function
shell_sort
(values: &mut [T])
src/sorting/shell_sort.rs:1
↓ 4 callers
Function
shift_rows_blocks
(blocks: &mut [Byte], mode: AesMode)
src/ciphers/aes.rs:334
↓ 4 callers
Function
sine
Returns the value of sin(x), approximated with the given tolerance This function supposes the argument is in radians ### Example sin(1) == sin(1 ra
src/math/trig_functions.rs:71
↓ 4 callers
Function
state_new
()
src/hashing/sha3.rs:29
↓ 4 callers
Function
stooge_sort
(arr: &mut [T])
src/sorting/stooge_sort.rs:17
↓ 4 callers
Function
sub_bytes_blocks
(data: &mut [Byte], mode: AesMode)
src/ciphers/aes.rs:328
↓ 4 callers
Function
tarjan_scc
(graph: &Graph)
src/graph/tarjans_ssc.rs:18
↓ 4 callers
Function
transpose_block
(block: &mut [u8])
src/ciphers/aes.rs:426
↓ 4 callers
Method
union
Unites the sets containing the two given values. Returns: - `None` if either value hasn't been inserted, - `Some(true)` if two disjoint sets have been
src/data_structures/union_find.rs:53
↓ 4 callers
Function
vernam_decrypt
Decrypts a ciphertext string using the Vernam cipher. The function converts all input to uppercase and works only with letters A-Z. The key is repeat
src/ciphers/vernam.rs:100
↓ 3 callers
Function
abs
This function returns the absolute value of a number.\ The absolute value of a number is the non-negative value of the number, regardless of its sign.
src/math/abs.rs:5
↓ 3 callers
Function
add
(a: &mut Word, b: Word)
src/hashing/blake2b.rs:52
↓ 3 callers
Method
add_msg
process a 16-byte-long message block. If message is not long enough, fill the `msg` array with zeros, but set `msg_bytes` to the original chunk length
src/big_integer/poly1305.rs:51
↓ 3 callers
Function
advance
(x: u128, c: u64, number: u64)
src/math/pollard_rho.rs:37
↓ 3 callers
Function
append_playaction
Promote only better or collate equally scored game plays
src/graph/depth_first_search_tic_tac_toe.rs:263
↓ 3 callers
Function
arithmetic_right_shift
Performs an arithmetic right shift on a number and returns the binary representation. Shifts the bits of `number` to the right by `shift_amount` posi
src/bit_manipulation/binary_shifts.rs:131
↓ 3 callers
Function
assert_permutations
(original: &[i32], permutations: &[Vec<i32>])
src/general/permutations/mod.rs:14
↓ 3 callers
Function
available_positions
(board: &[Vec<Players>])
src/graph/depth_first_search_tic_tac_toe.rs:152
↓ 3 callers
Method
balance_factor
Returns the height difference between the left and right subtrees.
src/data_structures/avl_tree.rs:210
↓ 3 callers
Function
bubble_sort
(arr: &mut [T])
src/sorting/bubble_sort.rs:1
↓ 3 callers
Function
cholesky
(mat: Vec<f64>, n: usize)
src/machine_learning/cholesky.rs:1
↓ 3 callers
Function
comb_sort
(arr: &mut [T])
src/sorting/comb_sort.rs:1
↓ 3 callers
Function
convert_time
Convert time from one unit to another # Arguments `time_value` - The time value to convert (must be non-negative) `unit_from` - The source unit (cas
src/conversions/time.rs:70
↓ 3 callers
Function
decode
Convert morse code to ascii. Given a morse code, return the corresponding message. If the code is invalid, the undecipherable part of the code is rep
src/ciphers/morse_code.rs:106
↓ 3 callers
Method
decompose
(&mut self, root: usize, adj: &Adj)
src/graph/heavy_light_decomposition.rs:66
↓ 3 callers
Function
decrypt_text
Decrypts a vector of encrypted values back to text # Arguments `ciphertext` - The vector of encrypted character values `private_key` - The private k
src/ciphers/rsa_cipher.rs:271
↓ 3 callers
Method
delete_head
(&mut self)
src/data_structures/linked_list.rs:111
↓ 3 callers
Function
demonstrate_huffman_from_file
(file_path: &str)
src/compression/huffman_encoding.rs:303
↓ 3 callers
Method
dfs_step
(&mut self, queue: &mut Vec<usize>, dfs_id: usize)
src/graph/decremental_connectivity.rs:112
↓ 3 callers
Function
encrypt_text
Encrypts a text message by converting each character to its ASCII value # Arguments `message` - The plaintext string `public_key` - The public key t
src/ciphers/rsa_cipher.rs:243
↓ 3 callers
Function
enumerate_graph
This function creates a graph with vertices numbered from 1 to n for any input `Graph<V>`. The result is in the form of Vec<Vec<usize> to make impleme
src/graph/graph_enumeration.rs:13
↓ 3 callers
Function
equated_monthly_installments
Calculates the Equated Monthly Installment (EMI) for a loan. Formula: A = p * r * (1 + r)^n / ((1 + r)^n - 1) where: - `p` is the principal - `r` is
src/financial/equated_monthly_installments.rs:20
↓ 3 callers
Function
exponential_moving_average
Calculate the exponential moving average (EMA) on the series of stock prices. Wikipedia Reference: <https://en.wikipedia.org/wiki/Exponential_smoothi
src/financial/exponential_moving_average.rs:35
↓ 3 callers
Function
fast_fourier_transform
(input: &[f64], input_permutation: &[usize])
src/math/fast_fourier_transform.rs:113
↓ 3 callers
Function
fast_fourier_transform_input_permutation
(length: usize)
src/math/fast_fourier_transform.rs:88
↓ 3 callers
Function
fast_power
fast_power returns the result of base^power mod modulus
src/math/fast_power.rs:2
↓ 3 callers
Method
find
(&self, prefix: &str)
src/string/autocomplete_using_trie.rs:31
↓ 3 callers
Method
find_by_key
Finds the root of the set containing the element with the given index.
src/data_structures/union_find.rs:62
↓ 3 callers
Method
find_encoding_token
Finds the encoding token for the current position in the text. This method searches the search buffer for the longest match with the beginning of the
src/compression/lz77.rs:198
↓ 3 callers
Method
floor
Returns the largest value in this tree smaller than value
src/data_structures/binary_search_tree.rs:113
↓ 3 callers
Function
gcd
Calculates the greatest common divisor using the iterative Euclidean algorithm. # Arguments `a` - First number `b` - Second number # Returns The G
src/ciphers/affine_cipher.rs:42
↓ 3 callers
Function
geometric_series
(nth_term: f64, start_term_a: f64, common_ratio_r: f64)
src/math/geometric_series.rs:5
↓ 3 callers
Method
get_u64
(&mut self)
src/math/random.rs:83
↓ 3 callers
Function
gradient_descent
Gradient Descent Optimization Gradient descent is an iterative optimization algorithm used to find the minimum of a function. It works by updating th
src/machine_learning/optimization/gradient_descent.rs:25
↓ 3 callers
Function
gronsfeld_encrypt
Encrypts `text` using the Gronsfeld cipher with the given digit `key`.
src/ciphers/gronsfeld.rs:56
↓ 3 callers
Function
heap_permute
Computes all permutations of an array using Heap's algorithm Read `recurse_naive` first, since we're building on top of the same intuition
src/general/permutations/heap.rs:5
↓ 3 callers
Function
heapify
Fixes a heap violation starting at the given index. This function adjusts the heap rooted at index `i` to fix the heap property violation. It assumes
src/sorting/heap_sort.rs:32
↓ 3 callers
Method
hopcroft_karp
(&mut self)
src/graph/bipartite_matching.rs:111
↓ 3 callers
Method
increment
(&mut self, item: Self::Item)
src/data_structures/probabilistic/count_min_sketch.rs:124
↓ 3 callers
Method
insert
(&mut self, text: &str)
src/string/autocomplete_using_trie.rs:21
↓ 3 callers
Method
insert
(&mut self, key: T)
src/data_structures/b_tree.rs:131
↓ 3 callers
Method
insert_at_head
(&mut self, obj: T)
src/data_structures/linked_list.rs:45
↓ 3 callers
Function
intro_sort
(arr: &mut [T])
src/sorting/intro_sort.rs:48
↓ 3 callers
Function
inverse_fast_fourier_transform
( input: &[Complex64], input_permutation: &[usize], )
src/math/fast_fourier_transform.rs:139
↓ 3 callers
Function
is_residue
(x: u64, modulus: u64)
src/math/quadratic_residue.rs:70
↓ 3 callers
Method
iter
(&self)
src/data_structures/veb_tree.rs:61
↓ 3 callers
Method
kuhn
Note: It does not modify self.mt1, it only works on self.mt2
src/graph/bipartite_matching.rs:46
↓ 3 callers
Function
logistic_regression
Returns the weights after performing Logistic regression on the input data points.
src/machine_learning/logistic_regression.rs:5
↓ 3 callers
Function
merge
Merges two trees and returns the root of the merged tree.
src/data_structures/avl_tree.rs:158
↓ 3 callers
Function
momentum
( derivative: impl Fn(&[f64]) -> Vec<f64>, x: &mut Vec<f64>, learning_rate: f64, beta: f64,
src/machine_learning/optimization/momentum.rs:29
↓ 3 callers
Function
multiply
(num1: i128, num2: i128)
src/math/karatsuba_multiplication.rs:7
↓ 3 callers
Function
npv
Calculates Net Present Value given a vector of cash flows and a discount rate. cash_flows: Vector of f64 representing cash flows for each period. rate
src/financial/npv.rs:5
↓ 3 callers
Method
num_vertices
Returns the number of vertices in the graph.
src/backtracking/hamiltonian_cycle.rs:51
↓ 3 callers
Method
peek
(&self)
src/data_structures/stack_using_singly_linked_list.rs:61
↓ 3 callers
Function
pollard_rho_get_one_factor
Note: using this function with `check_is_prime` = false and a prime number will result in an infinite loop. RNG's internal state is represented as `s
src/math/pollard_rho.rs:104
↓ 3 callers
Function
prufer_encode
(tree: &Graph<V>)
src/graph/prufer_code.rs:5
↓ 3 callers
Function
radix_sort
Sorts the elements of `arr` in-place using radix sort. Time complexity is `O((n + b) * logb(k))`, where `n` is the number of elements, `b` is the bas
src/sorting/radix_sort.rs:8
↓ 3 callers
Method
rotate
Performs a left or right rotation
src/data_structures/treap.rs:195
↓ 3 callers
Function
run_length_decode
(encoded: &[(char, i32)])
src/compression/run_length_encoding.rs:19
↓ 3 callers
Method
solve
(&mut self)
src/general/genetic.rs:174
↓ 3 callers
Function
state_copy
(dest: &mut State, src: &State)
src/hashing/sha3.rs:43
↓ 3 callers
Function
steinhaus_johnson_trotter_permute
<https://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm>
src/general/permutations/steinhaus_johnson_trotter.rs:2
↓ 3 callers
Function
topological_sort
Given a directed graph, modeled as a list of edges from source to destination Uses Kahn's algorithm to either: return the topological sort of the grap
src/graph/topological_sort.rs:16
↓ 3 callers
Function
trifid_decrypt
Decrypts a Trifid cipher encrypted message. # Arguments `message` - The message to decrypt `alphabet` - The characters used for the cipher (must be
src/ciphers/trifid.rs:57
↓ 3 callers
Method
update
(&mut self, target_range: Range<usize>, val: T)
src/data_structures/lazy_segment_tree.rs:74
↓ 3 callers
Method
update
(&mut self, data: &[u8])
src/hashing/hashing_traits.rs:58
↓ 3 callers
Method
update_height
Recomputes the `height` field.
src/data_structures/avl_tree.rs:220
↓ 3 callers
Function
update_step
(a: &mut i32, old_a: &mut i32, quotient: i32)
src/math/extended_euclidean_algorithm.rs:1
↓ 3 callers
Function
wiggle_sort
(nums: &mut Vec<i32>)
src/sorting/wiggle_sort.rs:8
↓ 3 callers
Function
word_to_bytes
(word: Word)
src/ciphers/aes.rs:445
↓ 2 callers
Function
_logarithmic_fibonacci
(n: u32)
src/dynamic_programming/fibonacci.rs:82
↓ 2 callers
Function
add_directed_edge
(tree: &mut Graph<V>, a: V, b: V)
src/graph/prufer_code.rs:34
↓ 2 callers
Method
adjacency_table_mutable
(&mut self)
src/data_structures/graph.rs:23
↓ 2 callers
Method
advance
Advance the PCG by `delta` steps in O(lg(`delta`)) time. By passing a negative i64 as u64, it can go back too.
src/math/random.rs:56
↓ 2 callers
Function
affine_generate_key
Generates a random valid key for the affine cipher. The key is generated such that: - key_a is coprime with the symbol set size - key_b is not 0 - Bo
src/ciphers/affine_cipher.rs:246
↓ 2 callers
Function
are_all_values_in_range
(values: &[f64])
src/machine_learning/loss_function/negative_log_likelihood.rs:53
↓ 2 callers
Function
arithmetic_left_shift
Performs an arithmetic left shift on a number and returns the binary representation. Note**: Arithmetic left shift is identical to logical left shift
src/bit_manipulation/binary_shifts.rs:220
↓ 2 callers
Function
bead_sort
Bead sort only works for sequences of non-negative integers. https://en.wikipedia.org/wiki/Bead_sort
src/sorting/bead_sort.rs:3
↓ 2 callers
Function
bi_add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/floyd_warshall.rs:77
↓ 2 callers
Function
bitonic_sort
(array: &mut [T], low: usize, length: usize, ascending: bool)
src/sorting/bitonic_sort.rs:18
↓ 2 callers
Function
blank_char_table
()
src/compression/move_to_front.rs:3
↓ 2 callers
Function
bogo_sort
(arr: &mut [T])
src/sorting/bogo_sort.rs:36
↓ 2 callers
Function
build_frequency_map
Counts the frequency of each character in the input string # Arguments `text` - The input string to analyze # Returns A HashMap mapping each chara
src/compression/huffman_encoding.rs:117
← previous
next →
201–300 of 2,908, ranked by callers