Created
March 3, 2017 23:00
-
-
Save ceme/701ab7b6ba0109fd5320e25d080f53eb to your computer and use it in GitHub Desktop.
Tower Of Hanoi generic recurrsive solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function move(n, from, to, using) | |
{ | |
if (n = 1) | |
print (“Move disk from “, from, “ to “, to); | |
else | |
{ | |
move (n-1, from, using, to); | |
move(1, from, to, using); | |
move(n-1, using, to, from); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment