Mention computing Dragon Curve parity in constant time#42
Mention computing Dragon Curve parity in constant time#42maneatingape merged 1 commit intomaneatingape:mainfrom
Conversation
075aa41 to
5a4ea53
Compare
|
https://www.reddit.com/r/adventofcode/comments/1r642oc/2016_day_16_in_review_dragon_checksum/ mentions OEIS A255070 as a source for a similar derivation of O(1) Dragon parity |
|
The existing However |
The existing O(log n) solution solves in under 1µs, so there is not really much to be shaved by swapping to an O(1) computation per bit. But it is still a fun read, so worth documenting for anyone else using this repository as a reference point. It is also worth adding a unit test of the example given in part 1.
Fair enough.
Patch revised in place. I did, however, salvage the unit test addition out of my bigger patch. |
|
Thanks for adding the test! |
Description
The existing O(log n) solution solves in under 1µs, so there is not
really much to be shaved by swapping to an O(1) computation per bit.
But it is still a fun read, so worth documenting for anyone else using
this repository as a reference point.
It is also worth adding a unit test of the example given in part 1.
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.