That's interesting.

when n = 3

We have been given this :F F F | E E E

Swap the middle element and it becomes: F E F | E F E

Which is what you want, but when n = 5

F F F F F | E E E E E

And you swap the middle element it becomes: F F E F F | E E F E E

So the same startegy doesn't apply.

But if you do with from the center for every alternate element, it works

for n = 3

F F F | E E E > F F E | F E E > E F E | E F E

It also works for n = 5 etc. So, It is a more uniform solution if you may.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to