Hi, I this might work.... a1,b1,a2,b2,a3,b3,a4,b4,a5,b5 swap the elements in pairs starting from the second element....traversing from the left to right the first 'b' element i.e a1-(a2,b1)-(a3,b2)-(a4,b3)-(a5,b4)-b5 do it again starting from b1 a1,a2-(a3,b1)-(a4,b2)-(a5,b3)-b4,b5 a1,a2,a3-(a4,b1)-(a5,b2)-b3,b4,b5 a1,a2,a3,a4,a4,b1,b2,b3,b4,b5
For odd number of elements: a1,b1,a2,b2,a3,b3,a4,b4,a5 a1-(a2,b1)-(a3,b2)-(a4,b3)-(a5,b4) a1,a2-(a3,b1)-(a4,b2)-(a5,b3)-b4 a1,a2,a3,(a4,b1)-(a5,b2)-b3,b4 a1,a2,a3,a4-(a5,b1)-b2,b3,b4 a1,a2,a3,a4,a5,b1,b2,b3,b4 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups-beta.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---