Doubly Linked Circular List in Ruby
For part 2 of the puzzle on day 9 of Advent of Code I needed an array with cheap insertion and removal. That was a perfect excuse to implemented a doubly linked circular list (in Ruby). It has 5 methods (append, remove, read, rotate and length) and a constructor. You can also convert to string, something that comes in handy for tests and during debugging. Methods These are the 5 methods: ...