Two sequences a and b are order equivalent if they have the same number of elements and if they both contain less than two numbers or if for all i, j, 1 ≤ i, j ≤ n, a[i] ≤ a[j] if and only if b[i] ≤ b[j], where n is the length of a sequence.Another way to say this is that two sequences are order equivalent if, when you replace the numbers in the sequences by their rank orders, the sequences of rank orders are identical.Examples of order equivalent sequences: <7, 5, 9, 13, 12> and <4, 2, 25, 33, 26> <12> and <8>In the first, case, the rank order of the sequence <7, 5, 9, 13, 12> is <4th, 5th, 3rd, 1st, 2nd>. The rank order of sequence <4, 2, 25, 33, 26> is also <4th, 5th, 3rd, 1st, 2nd>. So they are order equivalent.
The program must accept the two sequences with no separator between the two.
Comments
Leave a comment