|No such thing as a small change|
Sorting, given only comparisionsby Anonymous Monk
|on Sep 08, 2001 at 06:50 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I have data in comparision forms:
a1 a2 1 a2 a3 1 a4 a5 1 a5 a6 1 a6 a7 1 a1 a5 1 a5 a2 1 a4 a1 1 a7 a8 0above indicates ex. a2 is larger than a3 and a7 is same as a8.
First 2 lines also implies that a1 is larger than a3
I have to find where there is any comparision can be obtained or derived between given elements. ex. a3 and a6. ie.. whether a3 is larger , smaller or equal to a6 OR no relationship is defined yet between them.
The idea that comes to my mind is to find out all smaller elements than a3 and find out all larger elements and than check both array for a6.
Your suggestions will be helpful.