I need help with conversion function -
04-06-2012, 11:02 PM
I answered this question, but i need to complete using the conversion function.
pls help me
Question :
Reversal
In the world below, the row of skeletons (Spooky) is guarding the gate (Spooky). Every so often in this world, the row of skeletons is to reverse order. This project is to animate the reversal using the second form of recursion. The storyboard goes something like the following:
reverse
If the row of skeletons not yet reversed is more than one then
reverse the row of skeletons starting with the second skeleton (by recursively calling reverse)
move the head skeleton to the end of the row
The base case is when there is just one skeleton in the row (that has not yet been reversed). Of course, a row of 1 skeleton is already reversed! The recursive case (for n skeletons, where n is larger than 1) says to first reverse the last n−1 skeletons and then move the first skeleton to the end of the row.
Implement the Skeleton reversal storyboard given above. The program you write should be quite similar to the Towers of Hanoi program, including the which function.
|