2

According to http://en.wikipedia.org/wiki/Tower_of_Hanoi, the Tower of Hanoi requires $2^n-1$ transfers, where $n$ is the number of disks in the original tower, to solve based on recurrence relations.

Why is that? Intuitively, I almost feel that it takes a linear number of transfers since we must transfer all but the bottommost disc to the buffer before transferring the bottommost disc to the target tower.

David Faux
  • 3,425
  • Possible duplicate: http://math.stackexchange.com/questions/259607/can-someone-intuitively-explain-the-towers-of-hanoi-and-how-a-proof-by-induction?rq=1 – Amzoti Jun 17 '13 at 02:00

2 Answers2

2

Your intuition is right. All but the bottom disk must be moved TWICE, so you should expect (one more than) twice the number of transfers for one fewer disk. We have $$2(2^n-1)+1=2^{n+1}-1$$

vadim123
  • 82,796
1

supose you have 3 discs, $D_1,D_2,D_3$ and the $D_1$ is the little one, and $D_3$ is the bigger one, so you have to transfer $D_1$ to one tower and then you have to transfere $D_2$ to a different tower from the two others, so you put $D_1$ above $D_2$ and now you move $D_3$ to an other tower, so you put $D_1$ in the tower where $D_3$ was and you move $D_2$ to the towe where is $D_3$ , so you move $D_1$ to above $D_3$. In fact, if you need $k $ moves in one step with $n$ discs you will need $2k+1$ moves if you have $n+1$ discs, because you need $k$ to change the $n$ disc above the bigger one, you need one move to change the bigger one, and you need again $k$ moves to change the $n$ discs again above the bigger disc.

math_man
  • 1,574