Quote Originally Posted by AceInfinity View Post
For all we know without actually seeing the tree, it could just be a leftover stump, cut down many years ago with no branches. If I was to take this analogy further, it could be a spruce tree, an apple tree, etc... There's no telling the structure of the tree, just because "it's a tree", and the same thing applies here.

If it was really complex with many branches and different numbers of branches in some areas, then he could introduce a recursive function to retrieve the items. But I still haven't gotten a clear picture of what data he's dealing with.

~Ace
Well, we know this much, because we were told at the outset:
Quote Originally Posted by Techno
each item has a list of other items (grandparent > parent > child > children etc...)
The code I provided will work regardless of the number of levels and there was no luck involved in that.