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\")

 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 towe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site