Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/EbTech/rust-algorithms
/ functions
Functions
212 in github.com/EbTech/rust-algorithms
⨍
Functions
212
◇
Types & classes
33
↓ 43 callers
Method
push
(&mut self, (p, s): ArqView)
src/range_query/dynamic_arq.rs:99
↓ 32 callers
Method
add_edge
Adds a directed edge from u to v.
src/graph/mod.rs:77
↓ 27 callers
Method
update
Applies the endomorphism f to all entries from l to r, inclusive. If l == r, the updates are eager. Otherwise, they are lazy. # Panics Panics if r >
src/range_query/static_arq.rs:83
↓ 16 callers
Method
add_edge
Adds an edge with specified directional capacities and cost per unit of flow. If only forward flow is allowed, rcap should be zero.
src/graph/flow.rs:29
↓ 11 callers
Method
adj_list
Gets vertex u's adjacency list.
src/graph/mod.rs:100
↓ 11 callers
Method
num_v
Returns the number of vertices.
src/graph/mod.rs:67
↓ 10 callers
Method
add_undirected_edge
An undirected edge is two directed edges. If edges are added only via this funcion, the reverse of any edge e can be found at e^1.
src/graph/mod.rs:85
↓ 9 callers
Method
clone
(&self)
src/range_query/dynamic_arq.rs:13
↓ 8 callers
Method
recip
(self)
src/math/num.rs:36
↓ 6 callers
Method
num_e
Returns the number of edges, double-counting undirected edges.
src/graph/mod.rs:72
↓ 5 callers
Method
call
Performs a lookup into the HashMap to see if the value has already been calculated. If it has, returns the value. If it has not, calls the function, s
src/caching.rs:58
↓ 5 callers
Method
insert
Inserts a word into the trie, and returns the index of its node.
src/string_proc.rs:21
↓ 4 callers
Method
abs
(self)
src/math/num.rs:30
↓ 4 callers
Method
add_two_sat_clause
If we think of each even-numbered vertex as a variable, and its odd-numbered successor as its negation, then we can build the implication graph corres
src/graph/mod.rs:94
↓ 4 callers
Method
apply
(&mut self, p: usize, f: &T::F, s: i64)
src/range_query/static_arq.rs:40
↓ 4 callers
Method
build_from_slice
Builds a tree whose leaves are set to a given non-empty slice.
src/range_query/dynamic_arq.rs:69
↓ 4 callers
Function
convolution
Given two polynomials (vectors) sum_i a[i] x^i and sum_i b[i] x^i, computes their product (convolution) c[k] = sum_(i+j=k) a[i]*b[j]. Uses complex FFT
src/math/fft.rs:168
↓ 4 callers
Function
dft_from_reals
From a slice of reals (f64 or i64), computes DFT of size at least desired_len
src/math/fft.rs:140
↓ 4 callers
Function
first_negative
An example of binary search to find the first position whose element is negative. In this case, we use RMQ to locate the leftmost negative element. To
src/range_query/static_arq.rs:143
↓ 4 callers
Function
mod_mul
(a: i64, b: i64, m: i64)
src/math/mod.rs:36
↓ 4 callers
Method
push_to
(&mut self, p: usize)
src/range_query/static_arq.rs:63
↓ 4 callers
Method
rows
(&self)
src/math/num.rs:284
↓ 3 callers
Method
apply
(&mut self, f: &T::F, size: i64)
src/range_query/dynamic_arq.rs:33
↓ 3 callers
Method
dfs
(&self, root: usize)
src/graph/util.rs:64
↓ 3 callers
Method
get
Finds a word in the trie, and returns the index of its node.
src/string_proc.rs:39
↓ 3 callers
Function
idft_to_reals
The inverse of dft_from_reals()
src/math/fft.rs:154
↓ 3 callers
Method
lower
(&mut self, u: usize, val: usize)
src/graph/connectivity.rs:32
↓ 3 callers
Method
next
(&mut self)
src/math/fft.rs:19
↓ 3 callers
Function
pos_mod
TODO: deduplicate modular arithmetic code with num::Field
src/math/mod.rs:33
↓ 3 callers
Function
solve
(scan: &mut Scanner<R>, out: &mut W)
src/scanner.rs:86
↓ 2 callers
Function
asserting_cmp
Ordering algorithms. A comparator on partially ordered elements, that panics if they are incomparable # Example ``` use contest_algorithms::order::a
src/order.rs:13
↓ 2 callers
Method
build_from_identity
Lazily builds a tree initialized to the identity.
src/range_query/dynamic_arq.rs:63
↓ 2 callers
Method
clone_node
(&mut self, p_orig: usize)
src/range_query/dynamic_arq.rs:121
↓ 2 callers
Method
dinic
Dinic's algorithm to find the maximum flow from s to t where s != t. Generalizes the Hopcroft-Karp maximum bipartite matching algorithm. V^2E in gener
src/graph/flow.rs:45
↓ 2 callers
Function
extended_gcd
Finds (d, coef_a, coef_b) such that d = gcd(a, b) = a * coef_a + b * coef_b.
src/math/mod.rs:6
↓ 2 callers
Function
fast_gcd
Fast iterative version of Euclid's GCD algorithm
src/math/num.rs:8
↓ 2 callers
Method
find
Finds the set's representative. Do path compression along the way to make future queries faster.
src/graph/mod.rs:26
↓ 2 callers
Method
insert_left
(&mut self, pos: usize)
src/range_query/sqrt_decomp.rs:88
↓ 2 callers
Function
merge_sorted
Stably merges two sorted and totally ordered collections into one
src/order.rs:34
↓ 2 callers
Method
next
Returns next edge and vertex in the depth-first traversal Refs: https://www.geeksforgeeks.org/iterative-depth-first-traversal/ https://en.wikipedia.or
src/graph/util.rs:91
↓ 2 callers
Method
pow
Computes self^n in O(log n) time
src/math/num.rs:178
↓ 2 callers
Method
pull
(&mut self, p: usize)
src/range_query/static_arq.rs:59
↓ 2 callers
Method
pull
(&mut self, p: usize)
src/range_query/dynamic_arq.rs:114
↓ 2 callers
Method
pull_from
(&mut self, mut p: usize)
src/range_query/static_arq.rs:70
↓ 2 callers
Method
push
(&mut self, p: usize)
src/range_query/static_arq.rs:51
↓ 2 callers
Method
remove_left
(&mut self, pos: usize)
src/range_query/sqrt_decomp.rs:95
↓ 2 callers
Method
transpose
(&self)
src/math/num.rs:287
↓ 2 callers
Method
visit
(&mut self, u: usize)
src/graph/connectivity.rs:25
↓ 1 callers
Method
abs_square
(self)
src/math/num.rs:115
↓ 1 callers
Method
ac_match
Aho-Corasick algorithm, sets @return[i] = node corresponding to longest prefix of some pattern matching a suffix of text[0..=i].
src/string_proc.rs:176
↓ 1 callers
Method
bcc
(&mut self, data: &mut ConnectivityData, u: usize, par: usize)
src/graph/connectivity.rs:134
↓ 1 callers
Method
call_and_replace
Calls the function without performing a lookup and replaces the old return value with the new one, and returns it. Potentially useful if the function
src/caching.rs:68
↓ 1 callers
Method
cmp
(&self, other: &Self)
src/math/num.rs:92
↓ 1 callers
Function
dfs
( graph: &Graph, u: usize, l: &mut [usize], r: &mut [usize], p: &mut [usize], time: &m
tests/codeforces343d.rs:42
↓ 1 callers
Method
dijkstra
Single-source shortest paths on a directed graph with non-negative weights
src/graph/util.rs:43
↓ 1 callers
Method
dinic_augment
Pushes a blocking flow that increases the residual's s-t distance.
src/graph/flow.rs:80
↓ 1 callers
Method
dinic_search
Compute BFS distances to restrict attention to shortest path edges.
src/graph/flow.rs:63
↓ 1 callers
Method
eval_unoptimized
Evaluates the function at x
src/order.rs:124
↓ 1 callers
Method
evaluate
Evaluates the function at x with good amortized runtime
src/order.rs:135
↓ 1 callers
Method
evaluate
Finds the maximum mx+b among all lines in the structure. O(log N) complexity.
src/li_chao.rs:78
↓ 1 callers
Method
evaluate_impl
Because of the invariant established by add_line, we know that the best line for a given point is stored in one of the ancestors of its node. So we ac
src/li_chao.rs:61
↓ 1 callers
Method
get_end_pos_and_pat_id
For each non-empty match, returns where in the text it ends, and the index of the corresponding pattern.
src/string_proc.rs:188
↓ 1 callers
Method
insert_right
(&mut self, pos: usize)
src/range_query/sqrt_decomp.rs:16
↓ 1 callers
Method
is_cut_edge
In an undirected graph, determines whether e is a bridge
src/graph/connectivity.rs:186
↓ 1 callers
Method
is_cut_vertex
In an undirected graph, determines whether u is an articulation vertex.
src/graph/connectivity.rs:175
↓ 1 callers
Function
is_prime
Assuming x >= 0, returns whether x is prime
src/math/mod.rs:68
↓ 1 callers
Function
is_strong_probable_prime
(n: i64, exp: u64, r: i64, a: i64)
src/math/mod.rs:53
↓ 1 callers
Method
kmp_match
KMP algorithm, sets @return[i] = length of longest prefix of pattern matching a suffix of text[0..=i].
src/string_proc.rs:97
↓ 1 callers
Method
max_with
Replaces the represented function with the maximum of itself and a provided line
src/order.rs:102
↓ 1 callers
Method
max_with
Adds the line with slope m and intercept b. O(log N) complexity.
src/li_chao.rs:54
↓ 1 callers
Method
max_with_impl
Every node in the tree has the property that the line that maximizes its midpoint is found either in the node or one of its ancestors. When we visit
src/li_chao.rs:35
↓ 1 callers
Method
max_with_sorted
Similar to max_with but requires that (new_m, new_b) be the largest pair so far
src/order.rs:107
↓ 1 callers
Method
mcf
Among all s-t maximum flows, finds one with minimum cost, assuming s != t and no negative-cost cycles. # Panics Panics if the flow or cost overflow
src/graph/flow.rs:128
↓ 1 callers
Method
mcf_augment
Pushes flow along an augmenting path of minimum cost.
src/graph/flow.rs:181
↓ 1 callers
Method
mcf_search
Maintains Johnson's potentials to prevent negative-cost residual edges. This allows running Dijkstra instead of the slower Bellman-Ford.
src/graph/flow.rs:158
↓ 1 callers
Method
merge
Merges the sets containing u and v into a single set containing their union. Returns true if u and v were previously in different sets.
src/graph/mod.rs:36
↓ 1 callers
Method
merge_equal_sized
Merges two balanced subtrees into a single tree with a 0-indexed view.
src/range_query/dynamic_arq.rs:87
↓ 1 callers
Method
min_spanning_tree
Kruskal's minimum spanning tree algorithm on an undirected graph.
src/graph/util.rs:30
↓ 1 callers
Function
mod_exp
(mut base: i64, mut exp: u64, m: i64)
src/math/mod.rs:39
↓ 1 callers
Method
next
Produces an outgoing edge and vertex.
src/graph/mod.rs:118
↓ 1 callers
Method
next_u64
(&mut self)
src/rng.rs:45
↓ 1 callers
Function
palindromes
Manacher's algorithm for computing palindrome substrings in linear time. pal[2*i] = odd length of palindrome centred at text[i]. pal[2*i+1] = even len
src/string_proc.rs:294
↓ 1 callers
Method
partial_cmp
(&self, other: &Self)
src/math/num.rs:97
↓ 1 callers
Function
pollard_rho
(n: i64)
src/math/mod.rs:85
↓ 1 callers
Method
process
After initializing self to a state corresponding to an empty interval, call this function to answer all your queries.
src/range_query/sqrt_decomp.rs:24
↓ 1 callers
Method
query
(&self, _: &Self::Q)
src/range_query/sqrt_decomp.rs:85
↓ 1 callers
Method
query
Returns the aggregate range query on all entries from l to r, inclusive. # Panics Panics if r >= size. Note that l > r is valid, meaning an empty ra
src/range_query/static_arq.rs:115
↓ 1 callers
Method
remove_right
(&mut self, pos: usize)
src/range_query/sqrt_decomp.rs:19
↓ 1 callers
Function
scanner_from_file
(filename: &str)
src/scanner.rs:72
↓ 1 callers
Method
scc
(&mut self, data: &mut ConnectivityData, u: usize)
src/graph/connectivity.rs:89
↓ 1 callers
Function
slice_lower_bound
Assuming slice is sorted and totally ordered, returns the minimum i for which slice[i] >= key, or slice.len() if no such i exists
src/order.rs:19
↓ 1 callers
Function
solve
(scan: &mut Scanner<R>, out: &mut W)
tests/codeforces343d.rs:63
↓ 1 callers
Function
unsafe_solve
(scan: &mut UnsafeScanner<R>, out: &mut W)
src/scanner.rs:92
↓ 1 callers
Function
writer_to_file
(filename: &str)
src/scanner.rs:77
Method
add
(self, other: Self)
src/math/num.rs:61
Method
apply
(&f: &Self::F, _: &Self::S, _: i64)
src/range_query/specs.rs:58
Method
argument
(self)
src/math/num.rs:118
Function
canon_egcd
Assuming a != 0, finds smallest coef_b >= 0 such that a * coef_a + b * coef_b = c. # Panics Panics if a == 0.
src/math/mod.rs:20
Method
compose
(&f: &Self::F, _: &Self::F)
src/range_query/specs.rs:55
Method
compress
Returns Ok(i) if the coordinate q appears at index i Returns Err(i) if q appears between indices i-1 and i
src/order.rs:73
next →
1–100 of 212, ranked by callers