Document choice for using slower algorithm#41
Merged
maneatingape merged 1 commit intomaneatingape:mainfrom Feb 13, 2026
Merged
Conversation
maneatingape#32 proposed speeding up 2021 part 2 to use a linear algorithm; but the pull request was closed unapplied because the savings were in the noise compared to the already time-consuming algorithm required in parse to even get to the point where distances can be computed. Still, it is worth documenting the approach as an aid to anyone else using this repository for inspiration.
Contributor
Author
|
I'm also wondering if you plan on reviewing the change in #30 to go from O(n^2) to O(n log n) for 2025 day 9 part 1 (that conversation kind of got sidetracked about whether part 2 should not use an input-specific O(n) hack in place of the O(n log n) general solution). |
maneatingape
approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#32 proposed speeding up 2021 part 2 to use a linear algorithm; but the pull request was closed unapplied because the savings were in the noise compared to the already time-consuming algorithm required in parse to even get to the point where distances can be computed. Still, it is worth documenting the approach as an aid to anyone else using this repository for inspiration.
Type of change
Checklist
using the same naming conventions. Code should be portable, avoiding any architecture
specific intrinsics.
cargo testcargo fmt -- `find . -name "*.rs"`cargo clippy --all-targets --all-featuresFormatting and linting also can be executed by running
just(if installed) on the command line at the project root.