Perl Monk, Perl Meditation | |
PerlMonks |
Re: "Intelligent" array joiningby thospel (Hermit) |
on Feb 07, 2004 at 13:09 UTC ( [id://327310]=note: print w/replies, xml ) | Need Help?? |
Several good answers all based on basically doing a topological sort have already been given.
Can this problem also be solved without essentially doing a topological sort ? When you consider as input a sequence of arrays where each consists of two elements, that simply says the first element must come before the second, and you actually have the standard way to ask for a topological sort. So no, in general you can't. Any solution must also be able to do a topological sort.
In Section
Seekers of Perl Wisdom
|
|