There are 2n glasses standing next to each other in a row, the first n of them are filled with a soda drink, while the remaining n glasses are empty. Make the glasses alternate in a filledempty- filled-empty pattern in the minimum no of glass moves.
my soln is start with 2nd and (n+2)th swap them and then move to 4th and n+4th this is to be done n/2 times.....total swaps are n/2 .. and total moves n/2*2 ie n... mine is n moves ...any1 with some better answer ??? -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.