pub struct DynamicProgramming;Expand description
A collection of classic dynamic programming algorithms.
Implementations§
Source§impl DynamicProgramming
impl DynamicProgramming
Sourcepub fn knapsack(capacity: usize, weights: &[usize], values: &[usize]) -> usize
pub fn knapsack(capacity: usize, weights: &[usize], values: &[usize]) -> usize
0/1 knapsack: maximum value achievable with given capacity.
Sourcepub fn longest_common_subseq(s1: &[u8], s2: &[u8]) -> usize
pub fn longest_common_subseq(s1: &[u8], s2: &[u8]) -> usize
Length of the longest common subsequence of byte slices s1 and s2.
Sourcepub fn matrix_chain_order(dims: &[usize]) -> usize
pub fn matrix_chain_order(dims: &[usize]) -> usize
Minimum number of scalar multiplications to compute a chain of matrices.
dims has length n+1 where the i-th matrix is dims[i] × dims[i+1].
Auto Trait Implementations§
impl Freeze for DynamicProgramming
impl RefUnwindSafe for DynamicProgramming
impl Send for DynamicProgramming
impl Sync for DynamicProgramming
impl Unpin for DynamicProgramming
impl UnsafeUnpin for DynamicProgramming
impl UnwindSafe for DynamicProgramming
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more