Download presentation
Presentation is loading. Please wait.
Published byJared Griffin Briggs Modified over 9 years ago
1
Brian Thompson bthom@cs.rutgers.edu Puzzles TO ALGORITHMS August 20-21, 2012CS4HS Teacher Workshop @ Rutgers University1
2
Why Puzzles? Learning algorithms may be intimidating for students who are new to computer science Puzzles are more familiar and are frequently seen as challenging and fun Strategy: use puzzles to introduce computer science concepts, algorithms, and data structures Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University2
3
Fair Cake-Splitting Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University3
4
Fair Cake-Splitting Materials: worksheet, mini-cakes (be aware of allergies), knives, plates/napkins, Java applet: http://pidancer.com/Projects/CakeCutting/ http://pidancer.com/Projects/CakeCutting/ Puzzle: Split a cake amongst several people, so each is guaranteed to get his/her fair share Goal: Introduce the idea of an algorithm, demonstrate that algorithms can be used to solve everyday problems Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University4
5
Fair Cake-Splitting Hand out the worksheet, introduce the problem out loud. Have students form groups of 3, discuss the 2-person cake-splitting scenario in groups, raise hand if they have questions. After 5 minutes, choose a group to present their solution (and why it is fair for both participants). While groups discuss 3-person cake-splitting, hand out a mini-cake with knife and plate/napkin per group to try out their solution. After 5 minutes, ask for volunteers to present their solution. As a class, analyze whether the solution is fair. Encourage discussion. Present the “SAY WHEN” n-person fair cake-splitting algorithm. Discuss/prove why it is fair. Test out the “SAY WHEN” algorithm with the whole class using the Java applet here: http://pidancer.com/Projects/CakeCutting/.http://pidancer.com/Projects/CakeCutting/ Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University5
6
Tower of Hanoi Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University6
7
Tower of Hanoi Materials: Tower of Hanoi game, or make one yourself by bringing 4 stackable items of increasing size Puzzle: Transfer a stack of disks (or objects) from one pile to another, following two rules: (1) can only move one disk at a time (2) can’t place any disk on top of a smaller disk Goal: Introduce the (related) concepts of recursion and induction; problem-solving strategy of approaching a complex problem by first solving a simpler problem and then generalizing Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University7
8
Mazes Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University8
9
Mazes Materials: Worksheet with a maze, should be challenging enough that students will not see the solution immediately Puzzle: Design a general procedure to solve mazes that will work no matter how big or tricky the maze is Goal: Can be used to teach back-tracking, binary trees, depth-first search Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University9
10
The Calendar Game Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University10
11
The Calendar Game Materials: Calendar (handout or projector), pen or pencil, and scratch paper Puzzle: The Calendar Game, a 2-person turn- based game played on a standard calendar Goal: Learn how computers play games by thinking about how clever people play games; introduce the concepts of “winning positions” and “losing positions”; show how a different representation can make a problem easier Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University11
12
The Calendar Game Start at January 1 Alternate turns doing one of the following: – Jump to a later month, same day (e.g. January 1 August 1) – Jump to a later day, same month (e.g. January 1 January 12) – Can only jump forward in time – Must stay in the same year Whoever ends up on December 31 wins Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University12
13
The Calendar Game Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University13 Start Winner!
14
The Calendar Game Explain the rules of the game Play an example game with a student to demonstrate and make sure the rules are clear Students pair up and play against each other; go around and clarify rules if necessary After a few minutes, ask for volunteers to present their strategy; encourage discussion Present the analysis on the following slides Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University14
15
The Calendar Game 12345678910111213141516171819202122232425262728293031 1234567891011121314151617181920212223242526272829 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University15 Start Winner! Let’s represent the calendar a different way Work backwards: What happens if your opponent moves to Nov. 30?
16
The Calendar Game 12345678910111213141516171819202122232425262728293031 1234567891011121314151617181920212223242526272829 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 123456789101112131415161718192021222324252627282930 12345678910111213141516171819202122232425262728293031 Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University16 Start Winner! Discuss why the dark blue squares are “winning positions” If both players are clever, who wins? What is the winning first move?
17
Puzzles To AlgorithmsCS4HS Teacher Workshop @ Rutgers University17 Brian Thompson bthom@cs.rutgers.edu
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.