Answer to Question #192327 in Python for Ryukjak

Question #192327

Create an algorithm, using python


Move each bar from tower A to tower C. You can only move one bar at a time. You are not allowed to place the larger disk onto a smaller disk.



1
Expert's answer
2021-05-12T02:13:44-0400
tower(disk, A, B, C)
IF disk is equal 1, THEN
      move disk from A to C
   ELSE
      tower(disk - 1, A, C, B) 
      move disk from A to C     
      tower(disk - 1, B, A, C)   
   END IF
END

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS