Anda di halaman 1dari 1

To find no of moves:

𝒎 = 𝟐^𝒏 − 𝟏

To find no of disks:
𝒍𝒐𝒈(𝒎+𝟏)
𝒏=
Step 1 –apply formula on 511 𝒍𝒐𝒈(𝟐)

moves(m) and calculate no. of


disks n.
𝒍𝒐𝒈⁡(𝒎+𝟏) ∴ ⁡𝒎 = 𝒎𝒊𝒏𝒊𝒎𝒖𝒎⁡𝒏𝒐. 𝒐𝒇⁡𝒎𝒐𝒗𝒆𝒔⁡
𝒏= 𝒍𝒐𝒈⁡(𝟐) ∴ ⁡𝒏 = 𝒏𝒐. 𝒐𝒇⁡𝒅𝒊𝒔𝒌𝒔

Step 1 − Move n-1 disks from


source(A) to auxiliary(B).

Step 2 − Move nth disk from source(A) to destination(C).

Step 3 − Move n-1 disks from auxiliary(B) to destination(C).

Anda mungkin juga menyukai