Post on 16-Apr-2017
Algorithmic PuzzlesFirst Meetup 2016/12/12
Exhaustive SearchTry all possible candidate solutions until a solution
to the problem is found.
Exhaustive Search
• Magic Square p.4
BacktrackingAn important improvement over the brute-force
approach of exhaustive search.
Backtracking
• A method for generating candidate solutions while making it possible to avoid generating unnecessary candidates.
• state-space-tree
Backtracking
• The n-Queens Problem p.6
Decrease-and-Conquer
Finding a relationship between a solution to a given problem and a solution to its smaller
instance
Decrease-and-Conquer
• Celebrity Problem p.8• Decrease by one
• Number Guessing p.9• Decrease by half
Divide-and-ConquerPartition a problem into smaller subproblems,
solve each of them, combine their solutions to get a solution to the original problem.
Divide-and-Conquer
• Tromino Puzzle p.10
Transform-and-Conquer
Transform original problem into another problem, then solve the problem
Transform-and-Conquer
• transformation stage• instance simplification• representation change• problem reduction
• conquering stage
Transform-and-Conquer
• Anagram Detection p.11• Cash Envelopes p.12• Two Jealous Husbands p.12• Guarini’s Puzzle p.14• Optimal Pie Cutting p.15
Greedy ApproachA sequence of steps, each expanding a partially constructed solution until a complete solution is
reached.
Greedy Approach
• How to prove it’s indeed an optimal solution?
Greedy Approach
• Non-Attacking Kings p.16• Bridge Crossing at Night p.17
Iterative Improvement
Start with some easily obtainable approximation to a solution and improves upon it by repeated
applications of some simple step.
Iterative Improvement
• Lemonade Stand Placement p.18• Positive Changes p.19
Dynamic Programming
Solve problems with overlapping subproblems, where they are solved once and recorded results in a table which a solution to the original problem can
then be obtained.
Dynamic Programming
• Shortest Path Counting p.20