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
↓ 538 callers
Method
len
Returns the number of elements in the heap. # Returns The number of elements in the heap.
src/data_structures/heap.rs:63
↓ 360 callers
Method
iter
Returns an iterator over the elements in the heap. # Returns An iterator over the elements in the heap, in their internal order.
src/data_structures/heap.rs:103
↓ 342 callers
Method
push
Here are the primary forms that self can take are: self, &mut self and &self. Since push will modify the linked list, we need a mutable reference `&mu
src/data_structures/stack_using_singly_linked_list.rs:27
↓ 255 callers
Method
insert
Inserts a value into the Trie, associating it with a sequence of keys. # Arguments - `key`: An iterable sequence of keys (e.g., characters in a strin
src/data_structures/trie.rs:50
↓ 133 callers
Method
is_empty
Checks if the heap is empty. # Returns `true` if the heap is empty, `false` otherwise.
src/data_structures/heap.rs:71
↓ 68 callers
Method
add_edge
(&mut self, u: usize, v: usize)
src/graph/kosaraju.rs:17
↓ 62 callers
Function
add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/prim.rs:7
↓ 42 callers
Method
pop
Removes and returns the root element from the heap. # Returns The root element if the heap is not empty, otherwise `None`.
src/data_structures/heap.rs:88
↓ 41 callers
Method
get
Retrieves a reference to the value associated with a sequence of keys, if it exists. # Arguments - `key`: An iterable sequence of keys (e.g., charact
src/data_structures/trie.rs:69
↓ 38 callers
Method
add_edge
Add an directed edge u->v in the graph
src/graph/bipartite_matching.rs:27
↓ 34 callers
Method
iter_mut
(&mut self)
src/math/random.rs:105
↓ 32 callers
Method
insert_at_tail
(&mut self, obj: T)
src/data_structures/linked_list.rs:58
↓ 30 callers
Method
contains
Returns `true` if the tree contains a value.
src/data_structures/treap.rs:43
↓ 30 callers
Method
max
(&self)
src/data_structures/veb_tree.rs:57
↓ 29 callers
Function
add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/bellman_ford.rs:92
↓ 28 callers
Method
cmp
(&self, other: &Self)
src/graph/astar.rs:26
↓ 25 callers
Method
verify
(&self, angle: T, expected_result: f64, is_radian: bool)
src/math/trig_functions.rs:158
↓ 24 callers
Function
f
(h: &mut [Word; 8], m: Block, t: u128, flag: bool)
src/hashing/blake2b.rs:76
↓ 24 callers
Method
min
(&self)
src/data_structures/veb_tree.rs:53
↓ 23 callers
Function
convert_energy
(value: f64, from: EnergyUnit, to: EnergyUnit)
src/conversions/energy.rs:242
↓ 22 callers
Function
zero
()
src/math/abs.rs:30
↓ 21 callers
Function
page_rank
Calculates the PageRank for each node in a graph. The graph is represented as an adjacency list: `HashMap<Node, Vec<Node>>`, where each key is a sour
src/graph/page_rank.rs:14
↓ 21 callers
Method
remove
Removes a value from the tree. Returns `true` if the tree contained the value.
src/data_structures/treap.rs:69
↓ 19 callers
Method
add
Adds a new element to the heap and maintains the heap property. # Parameters - `value`: The value to add to the heap.
src/data_structures/heap.rs:79
↓ 17 callers
Function
assert_valid_permutation
(original: &[i32], permuted: &[i32])
src/general/permutations/mod.rs:26
↓ 17 callers
Method
cmp
(&self, b: &Self)
src/string/suffix_array.rs:14
↓ 16 callers
Method
adjacency_table
(&self)
src/data_structures/graph.rs:26
↓ 15 callers
Function
test_intersect
(s1: &Segment, s2: &Segment, result: bool)
src/geometry/segment.rs:139
↓ 14 callers
Function
affine_encrypt
Encrypts a message using the affine cipher. # Arguments `key` - The encryption key (encoded as key_a * SYMBOLS.len() + key_b) `message` - The plaint
src/ciphers/affine_cipher.rs:160
↓ 14 callers
Method
insert
(&mut self, key: K, value: V)
src/data_structures/rb_tree.rs:63
↓ 14 callers
Method
insert_at_ith
(&mut self, index: u32, obj: T)
src/data_structures/linked_list.rs:71
↓ 13 callers
Method
find
(&self, key: &K)
src/data_structures/rb_tree.rs:49
↓ 13 callers
Method
get
(&self, index: i32)
src/data_structures/linked_list.rs:186
↓ 13 callers
Function
metric_length_conversion
Converts a length value from one unit to another using string unit names. This function accepts both full unit names and abbreviations, and is case-i
src/conversions/order_of_magnitude_conversion.rs:232
↓ 13 callers
Function
simpsons_integration
(f: F, a: f64, b: f64, n: usize)
src/math/simpsons_integration.rs:1
↓ 13 callers
Method
step
Computes one update step. `params` holds the current parameter values θ_{t-1}. When `weight_decay` is `0.0` the update is standard Adam; any positive
src/machine_learning/optimization/adam.rs:91
↓ 12 callers
Function
add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/astar.rs:112
↓ 12 callers
Method
add_edge
(&mut self, edge: (&str, &str, i32))
src/data_structures/graph.rs:47
↓ 12 callers
Function
assert_approx_eq
(a: f64, b: f64)
src/math/geometric_series.rs:21
↓ 12 callers
Function
assert_sum_to_one
All ranks must sum to 1.0 (within tolerance).
src/graph/page_rank.rs:143
↓ 12 callers
Function
convert_metric_length
Converts a length value from one unit to another. # Arguments `value` - The numeric value to convert `from` - The unit to convert from `to` - The un
src/conversions/order_of_magnitude_conversion.rs:191
↓ 12 callers
Function
log_timed
(test_name: &str, f: F)
src/sorting/sort_utils.rs:58
↓ 12 callers
Method
next
(&mut self)
src/math/random.rs:47
↓ 11 callers
Function
classify
Classify a new data point using the learned weights and bias.
src/machine_learning/perceptron.rs:62
↓ 11 callers
Method
merge
Merges the sets containing `first_elem` and `sec_elem` using union by size. The smaller set is always attached to the root of the larger set to ensur
src/graph/disjoint_set_union.rs:75
↓ 11 callers
Function
naive_bayes
(training_data: Vec<(Vec<f64>, f64)>, test_point: Vec<f64>)
src/machine_learning/naive_bayes.rs:159
↓ 11 callers
Method
reduce
Reduces the representation into the range [0, p)
src/math/field.rs:49
↓ 11 callers
Function
rgb_to_hsv
Convert RGB color representation to HSV Converts from RGB (Red, Green, Blue) to HSV (Hue, Saturation, Value). # Arguments `red` - Red component (0-
src/conversions/rgb_hsv_conversion.rs:187
↓ 10 callers
Method
add_node
(&mut self, node: &str)
src/data_structures/graph.rs:69
↓ 10 callers
Function
find_minimum_change
# Minimum Coin Change (Greedy Algorithm) This module implements a greedy algorithm to find the minimum number of coins needed to make change for a gi
src/greedy/minimum_coin_change.rs:170
↓ 10 callers
Method
hash
(&self)
src/data_structures/hash_table.rs:74
↓ 10 callers
Method
insert
Insert a value into the appropriate location in this tree.
src/data_structures/binary_search_tree.rs:73
↓ 10 callers
Function
schedule_jobs
Schedules jobs to maximise total profit under deadline constraints. Returns the optimal [`ScheduleResult`] — the scheduled job sequence (in time-slot
src/greedy/job_sequencing.rs:79
↓ 10 callers
Function
strand_sort
# Strand Sort Strand Sort is a comparison-based sorting algorithm that works by repeatedly extracting increasing subsequences ("strands") from the in
src/sorting/strand_sort.rs:47
↓ 10 callers
Function
test_graham
(convex_hull: Vec<Point>, others: Vec<Point>)
src/geometry/graham_scan.rs:89
↓ 10 callers
Function
test_jarvis
(convex_hull: Vec<Point>, others: Vec<Point>)
src/geometry/jarvis_scan.rs:76
↓ 9 callers
Function
add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/dijkstra.rs:59
↓ 9 callers
Method
add_edge
(&mut self, source: usize, sink: usize, capacity: T)
src/graph/dinic_maxflow.rs:74
↓ 9 callers
Function
bingo_sort
(vec: &mut [i32])
src/sorting/bingo_sort.rs:11
↓ 9 callers
Method
count
Returns the number of disjoint sets.
src/data_structures/union_find.rs:98
↓ 9 callers
Method
euclidean_distance
(&self, other: &Point)
src/geometry/point.rs:25
↓ 9 callers
Function
generate_sine_wave
(frequency: f64, sample_rate: f64, duration_secs: f64)
src/signal_analysis/yin.rs:127
↓ 9 callers
Function
gnome_sort
(arr: &[T])
src/sorting/gnome_sort.rs:3
↓ 9 callers
Function
huffman_encode
Encodes text using Huffman coding # Arguments `text` - The input string to encode # Returns A tuple containing: - The encoded binary string - A Ha
src/compression/huffman_encoding.rs:208
↓ 9 callers
Method
insert
(&mut self, searched_key: K, new_value: V)
src/data_structures/skip_list.rs:95
↓ 9 callers
Function
perceptron
Returns the weights and bias after performing Perceptron algorithm on the input data points. The Perceptron is a binary classification algorithm that
src/machine_learning/perceptron.rs:4
↓ 9 callers
Function
quick_sort
(arr: &mut [T])
src/sorting/quick_sort.rs:42
↓ 9 callers
Function
quick_sort_3_ways
(arr: &mut [T])
src/sorting/quick_sort_3_ways.rs:43
↓ 9 callers
Function
ternary_search_rec
( target: &T, list: &[T], start: usize, end: usize, )
src/searching/ternary_search_recursive.rs:3
↓ 8 callers
Function
add_edge
(graph: &mut Graph<V>, a: V, b: V)
src/graph/graph_enumeration.rs:29
↓ 8 callers
Function
add_edge
(graph: &mut Graph<V, E>, v1: V, v2: V, c: E)
src/graph/floyd_warshall.rs:73
↓ 8 callers
Function
affine_decrypt
Decrypts a message using the affine cipher. # Arguments `key` - The decryption key (same as encryption key) `message` - The ciphertext message to de
src/ciphers/affine_cipher.rs:201
↓ 8 callers
Function
ant_colony_optimization
Solve the Travelling Salesman Problem using Ant Colony Optimization. Given a list of cities (as (x, y) coordinates), finds a near-optimal route that
src/graph/ant_colony_optimization.rs:236
↓ 8 callers
Method
delete
(&mut self, key: &K)
src/data_structures/rb_tree.rs:91
↓ 8 callers
Method
empty
A VEB tree is empty if the min is greater than the max.
src/data_structures/veb_tree.rs:66
↓ 8 callers
Function
exponential_search
(item: &T, arr: &[T])
src/searching/exponential_search.rs:3
↓ 8 callers
Function
fibonacci_search
(item: &T, arr: &[T])
src/searching/fibonacci_search.rs:4
↓ 8 callers
Function
generate_keypair
Generates an RSA keypair from two prime numbers # Arguments `p` - First prime number `q` - Second prime number (should be different from p) # Retur
src/ciphers/rsa_cipher.rs:148
↓ 8 callers
Function
insertion_sort
Sorts a mutable slice using in-place insertion sort algorithm. Time complexity is `O(n^2)`, where `n` is the number of elements. Space complexity is
src/sorting/insertion_sort.rs:5
↓ 8 callers
Method
partial_cmp
(&self, other: &Self)
src/general/huffman_encoding.rs:30
↓ 8 callers
Function
reverse_bwt
Reverses the Burrows-Wheeler transform to recover the original string. # Arguments `bwt_string` - The BWT-transformed string `idx_original_string` -
src/compression/burrows_wheeler_transform.rs:123
↓ 8 callers
Function
test_veb_tree
(size: u32, mut elements: Vec<u32>, exclude: Vec<u32>)
src/data_structures/veb_tree.rs:240
↓ 8 callers
Function
vernam_encrypt
Vernam Cipher The Vernam cipher is a symmetric stream cipher where plaintext is combined with a random or pseudorandom stream of data (the key) of th
src/ciphers/vernam.rs:40
↓ 8 callers
Function
win_check
(player: Players, board: &[Vec<Players>])
src/graph/depth_first_search_tic_tac_toe.rs:167
↓ 7 callers
Function
base16_decode
Decodes base16 (hexadecimal) encoded data into bytes. This function validates the input according to RFC 3548 Section 6: - The data must have an even
src/ciphers/base16.rs:78
↓ 7 callers
Function
bwt_transform
Performs the Burrows-Wheeler transform on a string. # Arguments `s` - The string to transform (must not be empty) # Returns A `BwtResult` containi
src/compression/burrows_wheeler_transform.rs:75
↓ 7 callers
Method
decompress
Decompresses a list of tokens back into the original text. # Arguments `tokens` - A slice of `Token`s representing compressed data # Returns The d
src/compression/lz77.rs:177
↓ 7 callers
Method
eq
(&self, other: &Self)
src/math/field.rs:70
↓ 7 callers
Method
get_u32
(&mut self)
src/math/random.rs:73
↓ 7 callers
Method
insert
(&mut self, item: Item)
src/data_structures/probabilistic/bloom_filter.rs:39
↓ 7 callers
Method
integer_mul
(self, mut n: i64)
src/math/field.rs:158
↓ 7 callers
Function
k_nearest_neighbors
( training_data: Vec<(Vec<f64>, f64)>, test_point: Vec<f64>, k: usize, )
src/machine_learning/k_nearest_neighbors.rs:17
↓ 7 callers
Method
next
(&mut self)
src/graph/heavy_light_decomposition.rs:109
↓ 7 callers
Method
predict
(&self, test_point: &[f64])
src/machine_learning/random_forest.rs:134
↓ 7 callers
Function
principal_component_analysis
Perform PCA on the input data Returns transformed data with reduced dimensions
src/machine_learning/principal_component_analysis.rs:135
↓ 7 callers
Function
sleep_sort
(vec: &[usize])
src/sorting/sleep_sort.rs:5
↓ 6 callers
Function
add_round_key
(data: &mut [Byte], round_key: &[Byte])
src/ciphers/aes.rs:320
↓ 6 callers
Function
base32_decode
Decodes base32-encoded data into bytes. The function decodes base32 format back to binary data, removing padding characters. # Arguments `data` - A
src/ciphers/base32.rs:93
↓ 6 callers
Function
bottom_up_merge_sort
(a: &mut [T])
src/sorting/merge_sort.rs:34
↓ 6 callers
Function
bucket_sort
Sort a slice using bucket sort algorithm. Time complexity is `O(n + k)` on average, where `n` is the number of elements, `k` is the number of buckets
src/sorting/bucket_sort.rs:7
next →
1–100 of 2,908, ranked by callers