You `Node` is basically same as `SinglyLinkedNode[int]`, so your question is 
`Can I insert or remove in arbitrary spots with rings?` The answer is 
unfortunately no...

I started part 1 with SinglyLinkedRing and then I found that the my program 
hang. Originally I thought I did something wrong in the while loop, but later I 
found that it is actually the `echo` on ring cause the indefinite hang... 
because I created new nodes instead of reusing existing ones. This costs me 
some time to debug...

For part 2, I just start with nodes only, no rings, reuse the same nodes and 
use a `Table[int, SinglyLinkedNode]` for lookup (an array maybe better 
actually). [My 
solution](https://github.com/jackhftang/adventofcode2020/blob/main/day23/day23_2.nim)
 is only one main proc. This is the same code as my final submission to AOC 
1331/447. 

Reply via email to