I don't think you understand. Let's say we have the following data:
abc
abc1
abc12
It's obvious that abc1 is a child of abc and abc12 is a child of abc1. But, is abc12 a direct child of abc or not? Your code would make abc12 a child of both abc and abc1.
Essentially, you are attempting to take a list and make a two-level structure out of it. That may be perfectly correct for your needs, but that's not a standard parent-child data structure. Normally, trees have as many levels as are necessary and a given node has one and only one parent. Your rules do not match those criteria.
Now, if you would give us what you're trying to accomplish, maybe we can help design the correct data structure, but all of our mind-reading helmets are currently in the shop.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|