reset password
Author Message
drami144
Posts: 1
Posted 17:39 Nov 04, 2018 |

Should Cains wife be in the family tree when printAllNodes runs although she is not a descendant of adam/eve?

jhurley
Posts: 207
Posted 18:01 Nov 04, 2018 |
drami144 wrote:

Should Cains wife be in the family tree when printAllNodes runs although she is not a descendant of adam/eve?

yes.  One way to do that would be to add every node to a set when created (remember, these are references, so this does not waste much memory.)  Another would be to create a set when you run getAllNodes(), start with the roots, but, for each descendant, check the parents (and their parents, etc) for any who are not yet in the set.