890 likes | 1.28k Views
Tower of hanoi. Pseudo code. 1. Start 2. It has 3 bars and 5 rings 3. Which bar will we move ring number1 to? 4. Bar C 5. Ring 1 in bar C 6. Which bar will we move ring number2 to? 7. Bar B 8. Ring 2 in bar B
E N D
Pseudo code 1. Start 2. It has 3 bars and 5 rings 3. Which bar will we move ring number1 to? 4. Bar C 5. Ring 1 in bar C 6. Which bar will we move ring number2 to? 7. Bar B 8. Ring 2 in bar B 9. Which bar will we move ring number1 to? 10. Bar B 11. Ring 1 in bar B 12. Which bar will we move ring number3 to?
10. Bar C 11. Ring 3 in bar C 12. Which bar will we move ring number1 to? 13. Bar A 14. Ring 1 in bar A 15. Which bar will we move ring number2 to? 16. Bar C 17. Ring 2 in bar C 18. Which bar will we move ring number1 to? 19. Bar C 20. Ring 1 in bar C 21. Which bar will we move ring number4 to? 22. Bar B 23. Ring 4 in bar B 24. Which bar will we move ring number1 to? 25. Bar B
26. Ring 1 in bar B 27. Which bar will we move ring number2 to? 28. Bar A 29. Ring 2 in bar A 30. Which bar will we move ring number1 to? 31. Bar A 32. Ring 1 in bar A 33. Which bar will we move ring number3 to? 34. Bar B 35. Ring 3 in bar B 36. Which bar will we move ring number1 to? 37. Bar C 38. Ring 1 in bar C 39. Which bar will we move ring number2 to? 40. Bar B 41. Ring 2 in bar B
42. Which bar will we move ring number1 to? 43. Bar B 44. Ring 2 in bar A 45. Which bar will we move ring number5 to? 46. Bar C 47. Ring 5 in bar C 48. Which bar will we move ring number1 to? 49. Bar A 50. Ring 1 in bar A 51. Which bar will we move ring number2 to? 52. Bar C 53. Ring 2 in bar C 54. Which bar will we move ring number1 to? 55. Bar C 56. Ring 1 in bar C 57. Which bar will we move ring number3 to ? 58. Bar A
59. Ring 3 in bar A 60. Which bar will we move ring number1 to? 61. Bar B 62. Ring 1 in bar B 63. Which bar will we move ring number2 to? 64. Bar A 65. Ring 2 in bar A 66. Which bar will we move ring number1 to? 67. Bar A 68. Ring 1 in bar A 69. Which bar will we move ring number4 to? 70. Bar C 71. Ring 4 in bar C 72. Which bar will we move ring number1 to? 73. Bar C 74. Ring 1 in bar C 75. Which bar will we move ring number2 to?
76. Bar B 77. Ring 2 in bar B 78. Which bar will we move ring number1 to? 79. Bar B 80. Ring 1 in bar B 81. Which bar will we move ring number3 to 82. Bar C 83. Ring 3 in bar C 84.. Which bar will we move ring number1 to? 85. Bar A 86. Ring 1 in bar A 87. Which bar will we move ring number2 to? 89. Bar C 90. Ring 2 in bar C 91. Which bar will we move ring number1 to? 92. Bar C
93. Ring 1 in bar C 94. Win 95. End ********************************
start 5 rings and 3bars Yes No Which bar will we move ring 1 to? Bar B Bar C Ring 1 in bar C
Which bar will we move ring 2 to? Yes No Bar B Bar C Ring 2 in bar B
Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B
Which bar will we move ring 3 to? Yes No Bar B Bar C Ring 3 in bar C
Which bar will we move ring 1 to? No Yes Bar A Bar C Ring 1 in bar A
Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C
Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C
Which bar will we move ring 4 to? Yes No Bar B Bar C Ring 4 in bar B
Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B
Which bar will we move ring 2 to? Yes No Bar A Bar B Ring 2 in bar A
Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A
Which bar will we move ring 3 to? Yes No Bar A Bar B Ring 3 in bar B
Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C
Which bar will we move ring 2 to? Yes No Bar B Bar C Ring 2 in bar B
Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B
Which bar will we move ring 5 to? Yes No Bar B Bar C Ring 5 in bar C
Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A
Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C
Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C
Which bar will we move ring 3 to? Yes No Bar A Bar C Ring 3 in bar A
Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B
Which bar will we move ring 2 to? Yes No Bar A Bar B Ring 2 in bar A
Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A
Which bar will we move ring 4 to? Yes No Bar A Bar C Ring 4 in bar C
Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C
Which bar will we move ring 2 to? No Yes Bar B Bar C Ring 2 in bar B
Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B
Which bar will we move ring 3 to? Yes No Bar B Bar C Ring 3 in bar C
Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A
Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C
Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C Win End