Solution (source code)

= Solution

Use a non-dummy <circular linked list> with a pointer to its last node:

``
private var last: Node = null
``

\b[Null represents the empty book.] In a nonempty book, `last.next` is the first node, and following `next` makes one finite simple cycle containing `last`. Names are unique around that cycle. This representation makes appending a new entry constant-time once a failed name search has established absence. The <abstraction function> collects every name/number pair on one complete turn of the cycle, rather than following pointers until null.