Skip to content

Commit

Permalink
Now that it's DFS, no point in preallocating much room for the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
kcaffrey committed Dec 19, 2023
1 parent f64fdef commit 9989ac2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
| [Day 16](./src/bin/16.rs) | `58.3µs` | `1.7ms` |
| [Day 17](./src/bin/17.rs) | `1.6ms` | `3.7ms` |
| [Day 18](./src/bin/18.rs) | `2.4µs` | `2.5µs` |
| [Day 19](./src/bin/19.rs) | `167.4µs` | `159.5µs` |
| [Day 19](./src/bin/19.rs) | `167.6µs` | `156.8µs` |

**Total: 14.41ms**
**Total: 14.40ms**
<!--- benchmarking table --->

---
Expand Down
2 changes: 1 addition & 1 deletion src/bin/19.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn part_two(input: &str) -> Option<u64> {

// DFS until we find accept nodes. Each path to an accept node results
// in a volume of possible ratings. The union of those volumes is our answer.
let mut stack = Vec::with_capacity(1000);
let mut stack = Vec::new();
stack.push(("in", PartFilter::new(1, 4000)));
let mut volume = 0;
while let Some((cur, filter)) = stack.pop() {
Expand Down

0 comments on commit 9989ac2

Please sign in to comment.