write an algorithm for solving towers of hanoi using 3 stack
write an algorithm for solving towers of hanoi using 3 stacks
write an algorithm for solving towers of hanoi using 3 stacks
write an algorithm for solving towers of hanoi using 3 stacks
Solution
def movTwr(height,fromPole,toPole,with pole);
If height >= 1;
movTwr(height-1,fromPole,withPole,toPole)
movDisk(fromPole,toPole)
movTwr(height-1,withPole,toPole,fromPole)
def movDisk(fp,tp);
print(\"moving disk from\",fp,\"to\",tp)
movTwr(3,\"A\",\"B\",\"C\")
