4 ms·
Should every node's value be printed out exactly once and if so, are there nodes which have two parents? If so, I would keep the pointers in a set to mark node
by kirab 10y ago
Should every node's value be printed out exactly once and if so, are there nodes which have two parents?
If so, I would keep the pointers in a set to mark nodes as processed but is there a more elegant solution?
- drakonandor 10y agoEach node is an object and has a "checked" variable.
- ng12 10y agoI would explicitly tell them that you should revisit nodes, and give them a few examples illustrating that point -- so all they needed to do was traverse edges.