Skip to content

Commit

Permalink
Convert VecDeque to Vec
Browse files Browse the repository at this point in the history
  • Loading branch information
europeanplaice committed Feb 19, 2022
1 parent 7199cd3 commit d9372f6
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 167 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "subset_sum"
version = "0.8.4"
version = "0.9.0"
edition = "2018"
authors = ["Tomohiro Endo <[email protected]>"]
description = "Solves subset sum problem and returns a set of decomposed integers. It also can match corresponding numbers from two vectors and be used for Account reconciliation."
Expand Down
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Call `subset_sum.exe num_set.txt 3`
The executable's name `subset_sum.exe` would be different from your choice. Change this example along with your environment.

In this example, the output is
`[[1, 2], [2, -3, 4], [1, -3, 5]]`
`[[2, 1], [4, -3, 2], [5, -3, 1]]`

### Sequence Matcher (One-to-Many)

Expand All @@ -52,9 +52,9 @@ Call `subset_sum.exe key.txt targets.txt`

In this example, the output is
```
[([3], 3), ([5], 5), ([1, -3, 4, 5], 7)]
[([3], 3), ([1, 4], 5), ([-3, 5, 5], 7)]
[([1, -3, 5], 3), ([5], 5), ([4, 3], 7)]
[([3], 3), ([5], 5), ([5, 4, -3, 1], 7)]
[([3], 3), ([4, 1], 5), ([5, 5, -3], 7)]
[([5, -3, 1], 3), ([5], 5), ([3, 4], 7)]
```

### Sequence Matcher (Many-to-Many)
Expand Down Expand Up @@ -117,13 +117,13 @@ subset_sum = "0.8.0"
use subset_sum::dp::find_subset;

fn main() {
let result = sequence_matcher(&mut vec![3, 5, 7], &mut vec![1, 5, -3, 4, 5, 3]);
let result = find_subset(&mut vec![1, 2, 3, 4, 5], 6);
println!("{:?}", result);
}
```
Output
```
[[-8, -10]]
[[3, 2, 1], [4, 2], [5, 1]]
```
### Sequence Matcher (One-to-Many)
`main.rs`
Expand All @@ -138,9 +138,9 @@ fn main() {
Output
```
[
[([3], 3), ([5], 5), ([1, -3, 4, 5], 7)],
[([3], 3), ([1, 4], 5), ([-3, 5, 5], 7)],
[([1, -3, 5], 3), ([5], 5), ([4, 3], 7)]
[([3], 3), ([5], 5), ([5, 4, -3, 1], 7)]
[([3], 3), ([4, 1], 5), ([5, 5, -3], 7)]
[([5, -3, 1], 3), ([5], 5), ([3, 4], 7)]
]
```
### Sequence Matcher (Many-to-Many)
Expand Down
Loading

0 comments on commit d9372f6

Please sign in to comment.