Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Reversal

hooksr
hooksr 


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 one skeleton is already reversed! The recursive case (for n skeletons, where n is larger than 1) says to first reverse the last 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 Attachments Tags Clarifications

Answers