-
September 21st, 2013, 09:07 PM
#1
tower of hanoi problem and problem solving
So i am able to code it, but only because i saw some sample code. the thing with this problem is that you don't expect that you would only need 2 recursive statements to solve it.
http://www.sparknotes.com/cs/recursi...section6.rhtml
Use the one disc solution to move the top disc to the intermediate pole.
Use the one disc solution to move the bottom disc to the final pole.
Use the one disc solution to move the top disc to the final pole.
Use the two disc solution to move the top discs to the intermediate pole.
Use the one disc solution to move the bottom disc to the final pole.
Use the two disc solution to move the top discs to the final pole.
Use the N - 1 disc solution to move the top discs to the intermediate pole.
Use the one disc solution to move the bottom disc to the final pole.
Use the N - 1 disc solution to move the top discs to the final pole
However, I think I could have done it if I read these 9 sentences without looking at the code, but only after a few tries. It's very difficult to simulate the whole thing in your head and even now I just have the gist of it and not the whole process in every minute detail. I can parse it, but I feel quite down, because I don't think I could have figured it on my own.
So I would like to know if most people are like me, or I am just really dumb. This problem is different from a simple for loop, which is easy to simulate in your head, so that was the big wall for me, so to speak. I can program it, but I feel like it's only because I remember the code and not because I fully understood it. I am wondering at what level most programmers understand the algorithm.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|