Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Alghrithm for Puzzle ,,,?

Mon Sep 20, 2010 2:07 am

can you help me in this algorithm plz ..

Alternating disks you have a row of 2n disks of two colors,n dark and n light.
They alternate:dark,light,dark,light,and so on.You want to get all the dark disks to the right-hand end,and all the light disks to the left-hand end. The only moves you are allowed to make are those that interchange the positions of two neighboring disks.

Design an algorithm for solving this puzzle and determine the number of moves it takes.



Post a reply