[From *Java Structures* by Duane Bailey. Modified (rewritten)
by Sam Rebelsky.]

Professor Perplexed has placed four coins in a five-grid space in order of decreasing diameter. He wants to know how to rearrange the coins so that they are in order of increasing diameter. He's decided to restrict movement so that it is only possible to place smaller coins on top of larger coins (or on top of empty spaces). What is the quickest strategy you can devise to reverse the order of coins?

Your goal is to go from

to+---+---+---+---+---+ | Q | N | P | D | | +---+---+---+---+---+

+---+---+---+---+---+ | | D | P | N | Q | +---+---+---+---+---+

Source text last modified Tue May 5 08:49:59 1998.

This page generated on Thu May 7 14:25:16 1998 by SiteWeaver.

Contact our webmaster at rebelsky@math.grin.edu