Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function hanoi(src,dst,n)
  2. {
  3.     var helper = 6 - (src+dst)
  4.  
  5.     if(n==1)
  6.     {
  7.         move(src);
  8.         move(dst);
  9.     }
  10.     else
  11.     {
  12.         hanoi(src,helper,n-1);
  13.         hanoi(src,dst,1);
  14.         hanoi(helper,dst,n-1);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement