Do you know where your variables are? | |
PerlMonks |
Re: perl questionby muba (Priest) |
on Sep 09, 2011 at 12:50 UTC ( [id://925076]=note: print w/replies, xml ) | Need Help?? |
Another issue that I haven't seen anyone else comment on yet, is that there's nothing to catch the situation where two nodes don't have a common ancestor — because if I understand what you're trying to do, it's that: find a common ancestor of any two nodes, am I right? But is it absolutely true that all nodes always live in the same tree? Addendum: trying to go over your code once again, I'm also struck by the, ehhh... weird... calling convention of getDistance. Normally, to get a distance between any two things, you need, well, any two things. Even in a question like, "how far is it to the supermarket?" what you're really asking is the distance between here and the supermarket. Yet, your getDistance sub is only called with one argument. I find that confusing. Edit: fixed some bad typing.
In Section
Seekers of Perl Wisdom
|
|