Function knapsack_small_quantity

Source
pub fn knapsack_small_quantity<W, V>(cap: W, ws: &[W], vs: &[V]) -> V
where W: Copy + Add<Output = W> + Ord + Zero, V: Copy + Add<Output = V> + Ord + Zero,
Expand description

要素数が小さいナップサック問題

Time complexity $O(n 2 ^ {n / 2})$

Space complexity $O(2 ^ {n / 2})$