Skip to content

Instantly share code, notes, and snippets.

@ceme
Created March 3, 2017 23:00
Show Gist options
  • Save ceme/701ab7b6ba0109fd5320e25d080f53eb to your computer and use it in GitHub Desktop.
Save ceme/701ab7b6ba0109fd5320e25d080f53eb to your computer and use it in GitHub Desktop.
Tower Of Hanoi generic recurrsive solution
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