*This preview shows
pages
1–20. Sign up
to
view the full content.*

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **Union-Find 15-211: Fundamental Data Structures and Algorithms Charlie Garrod 14 January 2010 Reading for today: Weiss Ch. 24 2 Administrivia Re: collaboration policy You may use your own work You may use the official course text Switching sections? Talk to us after lecture HW0 out today? Due next Tuesday Theory questions in lecture Programming assignment to FrontDesk by midnight 3 The plan for the first few weeks 1 T 12-Jan Introduction, Mazes R 14-Jan Union-Find 2 T 19-Jan Asymptotics & Recurrences R 21-Jan Lists, O-O 3 T 26-Jan Hashing, part 1 R 28-Jan Hashing, part 2 4 Why Union-Find? How to think like a computer scientist What problem are we solving? What is the abstract problem? How do we represent the concepts? How do we solve the problem? What is the algorithm? How efficient is our solution? Is our solution correct ? 5 Mazes: our intent We want to write a program to generate and solve mazes Our requirements: Solvable There is a path from start to finish Game-play assumptions 1. Upper left to lower right 2. The entire area is reachable 3. One solution path and no loops or cycles 4. Random designs How should we develop our solution? a b c d h g f e i j k l p o n m 6 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 7 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 8 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 9 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 10 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 11 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 12 Mazes: the algorithm 1. Start with a fully-walled maze 2. Randomly pick a wall and delete it if it wont create a cycle 3. Stop when a spanning tree has been created a b c d h g f e i j k l p o n m 13 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 14 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 15 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 16 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 17 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 18 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 19 Mazes as graphs a b c d h g f e i j k l p o n m a b c d e f g h i j k l m n o p 20...

View
Full
Document