Trees Section 6.5
6.5 Trees 2 Trees Definition Examples Two Examples
6.5 Trees 3 3 Topics 1.Minimal Cost Spanning Trees 2.Counting Trees 3.Searching Trees Animations
6.5 Trees 4 Minimal Cost Spanning Tree Example: A planned community Build a road system to begin for a 1000-acre planned community. It will include a convenience store, golf course, tennis courts, and three condo units The developer has two goals 1. 2.
6.5 Trees Golf S Condo 1 Condo 3 Tennis Condo 2 Units in $1,000’s
6.5 Trees 6 Best of the 3 animations was $72,000. You can do better. Click when you find one Golf S Condo 1 Condo 3 Tennis Condo 2 Units in $1,000’s 1.Got it 0 of 30
6.5 Trees Yes No, loop Yes No, loop Yes Stop $, Golf S Condo 1 Condo 3 Tennis Condo 2 Units in $1,000’s
6.5 Trees 8 Summarize the Algorithm Resulting set of edges is called a minimal cost spanning tree Joseph Kruskal
6.5 Trees 9 Understanding the terms “Minimal cost” = Obvious “Spanning” = No isolated vertices “Tree” = A graph with no loops
6.5 Trees 10 Continental Cable Vision will have to spend 1. $405, $456, $505, $528, None of the above Avon Simsbury Suffield Bloomfield Vernon South Windsor Granby Units in $1,000’s 0 of 30
6.5 Trees Counting Two teams, A and B, play a “best-of 5” game series. For example, here are some ways that A could win: In how many different ways can A win the series?
6.5 Trees 12 And the answer is…? of 30
6.5 Trees 13 A “Tree” Solution
6.5 Trees 14 “Red Sox vs. Yanks” The Red Sox play the Yanks in an unusual 4-game series. If the visiting team (in this case the beloved Red Sox) wins two games, they win the series. The home team must win three games to win the series For example: In how many different ways can the series be played?
6.5 Trees 15 And the answer is…? 1. 4 ways 2. 6 ways 3. 8 ways ways
6.5 Trees 16
6.5 Trees 17 A red chip, a white chip, and a blue chip are placed in a container. A person blindly picks one chip, notes its color, and then replaces it in the container. The person then chooses a second chip from the container and notes its color. Use a tree to determine the number of ways in which exactly one of the two chips drawn is the blue chip
6.5 Trees Searching You secretly choose an integer from I claim that I can find your number after I ask you X “yes/no” questions. What is X? More than 20
6.5 Trees 19 Range# Questions 1 - 1,000, , , ,
End of 6.5
6.5 Trees Units are in $1,000’s $0$30,000$57,000$87,000$115,000$131,000
6.5 Trees Units are in $1,000’s $0$30,000$53,000$67,000$94,000$122,000
6.5 Trees Units are in $1,000’s $0 $11,000 $21,000 $35,000 $54,000 $72,000
6.5 Trees 24 Family Trees
6.5 Trees 25 Zork
6.5 Trees 26 Minimal Cost Spanning Trees Joseph B. Kruskal
Meta - Material
6.5 Trees 28 0 / 30 A tree has ten vertices of degree 2, ten vertices of degree 3, ten vertices of degree 4, one vertex of degree 5, and its remaining vertices have degree 1. How many vertices are in the graph? 1. Matt????
6.5 Trees 29 Cheapest Link Like NN start with two closest vertices, but keep on selecting pairs of vertices with the shortest distance between them. Not just the ones adjacent to the already selected pairs. Restrictions: don’t complete a circuit until all vertices are included A link may not be added if it results in more than two edges coming from the same vertex
6.5 Trees 30 Nearest Insertion Start once again with two closest vertices Then make a circuit using those two and a third vertex, namely the one that is nearer to either one of the original two vertices Now include the unused vertex closest to any of the three.
6.5 Trees 31 Bonus questions Jack and Jill were at a party with three other married couples. As people were introduced a good deal of handshaking took place. No one shook hands with his or her spouse No none shook hands with herself or himself No one shook hands with anyone more than once. When leaving the party, Jill asked the other seven people how many hands they had shaken aand received 7 different answers. How many hands did Jill shake at the party? How many handshakes for Jack?
6.5 Trees 32 Ex. 3 Oil Pipeline A pipeline is to be constructed to take oil across the northern part of Canada Find the minimum cost to ship the oil between connecting points
6.5 Trees 33 A B C G E D F Units in $10,000’s
6.5 Trees 34 0 / 30 And, the answer is ….. (Choose the closest answer) 1. $49, $55, $59, $69, $73,000
6.5 Trees 35 0 / 30 Test question? If there are N locations (vertices), how many edges are there? 1. N 2. N N –
6.5 Trees 36 Cable Service Continental Cable Vision wishes to bring their services to 7 towns in CT. Every pair of towns must be connected by the service. Construct a minimal cost-spanning tree to solve the problem Avon Simsbury Suffield Bloomfield Vernon South Windsor Granby Units in $1,000’s
6.5 Trees 37