On Fri Nov 11 19:17:33 2022 +0000, Esme Povirk wrote:
I think in practice if you can handle 2 children this way, you can handle many children.
I was thinking something like this would work: ``` add_child(parent, child): prev_last_child = parent->last_child parent->last_child = child child->parent = parent if (prev_last_child): prev_last_child->next_sibling = child child->prev_sibling = prev_last_child else: parent->first_child = child ```
But it now occurs to me that you could special-case it to only handle up to 2 children.