in reply to Re: Creating tree with unique categories out of parent-child pointer list
in thread Creating tree with unique categories out of parent-child pointer list

ikegami, that is brilliant. Simple, elegant, awesome. My code tends to be... none of those.

Anyway, I wanted to make sure I understood the logic. You are basically only checking if a parent is "seen," since a child by definition should be unique? (per the parameters of my request that is?)

  • Comment on Re^2: Creating tree with unique categories out of parent-child pointer list

Replies are listed 'Best First'.
Re^3: Creating tree with unique categories out of parent-child pointer list
by ikegami (Patriarch) on Jun 17, 2009 at 15:47 UTC

    Every child is replaced with a unique string.

    Every parent is replaced with the replacement string used the last time it was seen as a child.

    It assumes the output is depth-first dump of the tree, and that the same key doesn't occur at different levels in a node path.