1 / 76

Tower of hanoi

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

nenet
Download Presentation

Tower of hanoi

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tower of hanoi

  2. 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?

  3. 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

  4. 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

  5. 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

  6. 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?

  7. 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

  8. 93. Ring 1 in bar C 94. Win 95. End ********************************

  9. Flow Chart

  10. start 5 rings and 3bars Yes No Which bar will we move ring 1 to? Bar B Bar C Ring 1 in bar C

  11. Which bar will we move ring 2 to? Yes No Bar B Bar C Ring 2 in bar B

  12. Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B

  13. Which bar will we move ring 3 to? Yes No Bar B Bar C Ring 3 in bar C

  14. Which bar will we move ring 1 to? No Yes Bar A Bar C Ring 1 in bar A

  15. Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C

  16. Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C

  17. Which bar will we move ring 4 to? Yes No Bar B Bar C Ring 4 in bar B

  18. Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B

  19. Which bar will we move ring 2 to? Yes No Bar A Bar B Ring 2 in bar A

  20. Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A

  21. Which bar will we move ring 3 to? Yes No Bar A Bar B Ring 3 in bar B

  22. Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C

  23. Which bar will we move ring 2 to? Yes No Bar B Bar C Ring 2 in bar B

  24. Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B

  25. Which bar will we move ring 5 to? Yes No Bar B Bar C Ring 5 in bar C

  26. Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A

  27. Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C

  28. Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C

  29. Which bar will we move ring 3 to? Yes No Bar A Bar C Ring 3 in bar A

  30. Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B

  31. Which bar will we move ring 2 to? Yes No Bar A Bar B Ring 2 in bar A

  32. Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A

  33. Which bar will we move ring 4 to? Yes No Bar A Bar C Ring 4 in bar C

  34. Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C

  35. Which bar will we move ring 2 to? No Yes Bar B Bar C Ring 2 in bar B

  36. Which bar will we move ring 1 to? Yes No Bar A Bar B Ring 1 in bar B

  37. Which bar will we move ring 3 to? Yes No Bar B Bar C Ring 3 in bar C

  38. Which bar will we move ring 1 to? Yes No Bar A Bar C Ring 1 in bar A

  39. Which bar will we move ring 2 to? Yes No Bar A Bar C Ring 2 in bar C

  40. Which bar will we move ring 1 to? Yes No Bar B Bar C Ring 1 in bar C Win End

More Related