in reply to Re: Re: Algorithm performance enhancement needed
in thread Algorithm performance enhancement needed

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

Replies are listed 'Best First'.
Re: Re: Re: Re: Algorithm performance enhancement needed
by Anonymous Monk on Apr 14, 2004 at 17:25 UTC
    lol...Sorry about that. You're correct. What I'm trying to accomplish is a two level structure one being the parent in this case: "abc" and all it's asscoiated children below: "abc1", and "abc12"

    I guess the best way to explain it is that the parent should be the shortest sub-string in the match and all it's children should contain that shortest sub-string.

    I hope that helps, and I wish you did have my mind reading helmet there :)
    Thanks!