离散数学英文课件:DM_lecture4_4_5 Recursive Algorithms.pptVIP

  • 4
  • 0
  • 约8.32千字
  • 约 28页
  • 2020-09-24 发布于安徽
  • 举报

离散数学英文课件:DM_lecture4_4_5 Recursive Algorithms.ppt

§4.4: Recursive Algorithms Towers of Hanoi “Towers of Hanoi” is commonly used as an example of a problem with a simple recursive solution There are three pegs The first (source) peg holds some number of rings Solution to Towers of Hanoi Move the top n-1 rings from src to aux (recursively) Move the largest ring from src to dest Move the n-1 rings from aux to dest (recursively) Tiling Tiling: Trivial Case (n = 1) Trivial case (n = 1): tiling a 2x2 board with a hole: Tiling: Dividing the Problem To get smaller square boards let’s divide the original board into for boards Tiling: Dividing the

文档评论(0)

1亿VIP精品文档

相关文档