Question: Sorting: Alternating Order

I need to sort a list of vectors according to the alternating order defined as such: 

x <_alt y if x and y differ first in the ith place and

i is even and x_i > y_i or i is odd and x_i < y_i

(so that in even positions, the order is "flipped", and in odd positions, the order is the standard order).  

In this way, we arrive at 

0101 <_alt 0110 <_alt 0001 <_alt 1101 <_alt 1001

 

Below is an attempt...  

L:= [[ 0, 1, 0, 1], [0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 0, 1], [1, 0, 0, 1]]

(in my actual code, my vectors will need to be of length 20).  

 Thank you for all of your help.  

Please Wait...