Algorithmic Puzzles.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Algorithmic Puzzles.ppt

Catching a Spy (Algorithmic Puzzles, #136) How to catch the spy? 0 1 2 3 4 -1 -2 -3 -4 Algorithmic Puzzles and Main CS Ideas Tower of Hanoi (édouard Lucas, 1883) There are n disks of different sizes and three pegs. Initially, all the disks are on the first peg in order of size, the largest on the bottom and the smallest on top. The objective is to transfer all the disks to another peg by a sequence of moves. Only one disk can be moved at a time, and it is forbidden to place a larger disk on top of a smaller one. Algorithmic Puzzles and Main CS Ideas All 9 general algorithm design strategies can be nicely illustrated by algorithmic puzzles, showing applicability of the strategies to problems outside traditional computing domain See: A. Levitin, Introduction to the Design and Analysis of Algorithms, 3rd ed., 2011 A. Levitin and M. Levitin, Algorithmic Puzzles, 2011 A. Levitin and M.-A. Papalaskari, Proc. of SIGCSE’02 Algorithmic Puzzles and Main CS Ideas Insolvability of some problems and the idea of an invariant: a property that doesn’t change by any of the operations allowed in the problem Parity (e.g. 7 Bridges of K?nigsberg, the Fifteen Puzzle) Coloring (e.g. many tiling and chessboard tour problems) Algorithmic Puzzles and Main CS Ideas Algorithm efficiency False Coin Detection Find a lighter fake among n coins with a balance scale without any weights. Brute force: weigh coin pairs (1 vs. 1) Divide-by-half: divide into two halves (with 1 aside if n is odd) and compare their weights Divide into 3 about equal subsets is better than dividing into two Schweik’s Puzzle (Algorithmic Puzzles, #50) Note: The puzzle alludes to the hero of the novel The Good Soldier Schweik by the Czech writer Yaroslav Ha?ek (1883--1923). In this satirical novel, Schweik is depicted as a simple minded man who appears to be eager to execute orders but does it in a manner that, in fact, contradicts their intended goal. The good soldier Schweik had

文档评论(0)

wsh1288 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档