The Towers of Hanoi is an ancient puzzle played with three stacks and any number of differently-sized disks. At the start, all the disks are in the leftmost stack, with the largest disk on the bottom and the smallest on the top. The object is to get all the disks over to the rightmost stack. You can only move one disk per move, and you can only move the top disk on a stack. The top disk of any stack can be moved to the top disk of any other stack, with the restriction that you can't move a larger disk on top of a smaller disk i.e., disks can only be moved to empty stacks or on top of larger disks. minimum number of movement for the disk is by using the mathematical formula 2n-1.where N is the number of disk in stack.
Mi Piace 55%