Module dpss::dp

source · []
Expand description

This is a module for dynamic programming.

Functions

Finds subsets sum of a target value. It can accept negative values.

Finds subsets sum of a target value. It can’t accept negative values but relatively faster.

Finds the integers from two vectors that sum to the same value. This method assumes that the two vectors have One-to-Many relationships. Each integer of the key vector corresponds to the multiple integers of the value vector.

Finds the integers from two vectors that sum to the same value. This method assumes that the two vectors have Many-to-Many relationships. Each integer of the keys vector corresponds to the multiple integers of the targets vector. With this method, we can find some combinations of the integers. n_candidates is the number of candidates to be selected. max_key_length is the maximum length of the keys as a group. Especially in long sequences, this method is slow so n_candidates, max_key_length, and max_target_length should be small.