Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trees Section 6.5 6.5 Trees 2 Trees Definition Examples Two Examples.

Similar presentations


Presentation on theme: "Trees Section 6.5 6.5 Trees 2 Trees Definition Examples Two Examples."— Presentation transcript:

1

2 Trees Section 6.5

3 6.5 Trees 2 Trees Definition Examples Two Examples

4 6.5 Trees 3 3 Topics 1.Minimal Cost Spanning Trees 2.Counting Trees 3.Searching Trees Animations

5 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 6.5 Trees 5 27 30 10 21 11 28 16 Golf S Condo 1 Condo 3 Tennis 14 18 19 16 30 23 14 Condo 2 Units in $1,000’s

7 6.5 Trees 6 Best of the 3 animations was $72,000. You can do better. Click when you find one 27 30 10 21 11 28 16 Golf S Condo 1 Condo 3 Tennis 14 18 19 16 30 23 14 Condo 2 Units in $1,000’s 1.Got it 0 of 30

8 6.5 Trees 7 10 11 16 14 18 16 14 Yes No, loop Yes No, loop Yes Stop $,000 27 30 10 21 11 28 16 Golf S Condo 1 Condo 3 Tennis 14 18 19 16 30 23 14 Condo 2 Units in $1,000’s

9 6.5 Trees 8 Summarize the Algorithm 1. 2. 3. Resulting set of edges is called a minimal cost spanning tree Joseph Kruskal

10 6.5 Trees 9 Understanding the terms “Minimal cost” = Obvious “Spanning” = No isolated vertices “Tree” = A graph with no loops

11 6.5 Trees 10 Continental Cable Vision will have to spend 1. $405,000 2. $456,000 3. $505,000 4. $528,000 5. None of the above Avon Simsbury Suffield Bloomfield Vernon South Windsor 92 82 94 80 77 100 85 90 98 97 75 100 Granby Units in $1,000’s 0 of 30

12 6.5 Trees 11 2. 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?

13 6.5 Trees 12 And the answer is…? 1. 6 2. 8 3. 10 4. 12 0 of 30

14 6.5 Trees 13 A “Tree” Solution

15 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?

16 6.5 Trees 15 And the answer is…? 1. 4 ways 2. 6 ways 3. 8 ways 4. 10 ways

17 6.5 Trees 16

18 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 1.2 2.3 3.4 4.5

19 6.5 Trees 18 3. Searching You secretly choose an integer from 1-100. I claim that I can find your number after I ask you X “yes/no” questions. What is X? 1. 7-10 2. 11-15 3. 16-20 4. More than 20

20 6.5 Trees 19 Range# Questions 1 - 1,000,000 1 - 100,000 1 - 10,000 1 - 1,000 1 - 100

21 End of 6.5

22 6.5 Trees 21 27 30 10 21 11 28 16 14 18 16 30 23 19 14 Units are in $1,000’s $0$30,000$57,000$87,000$115,000$131,000

23 6.5 Trees 22 27 30 10 21 11 28 16 14 18 16 30 23 19 14 Units are in $1,000’s $0$30,000$53,000$67,000$94,000$122,000

24 6.5 Trees 23 27 30 10 21 11 28 16 14 18 16 30 23 19 14 Units are in $1,000’s $0 $11,000 $21,000 $35,000 $54,000 $72,000

25 6.5 Trees 24 Family Trees

26 6.5 Trees 25 Zork

27 6.5 Trees 26 Minimal Cost Spanning Trees Joseph B. Kruskal 1928 -

28 Meta - Material

29 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????

30 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

31 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.

32 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?

33 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

34 6.5 Trees 33 A B C G 40 35 25 10 60 20 60 20 50 60 20 50 60 15 25 30 55 E D F 50 30 Units in $10,000’s

35 6.5 Trees 34 0 / 30 And, the answer is ….. (Choose the closest answer) 1. $49,000 2. $55,000 3. $59,000 4. $69,000 5. $73,000

36 6.5 Trees 35 0 / 30 Test question? If there are N locations (vertices), how many edges are there? 1. N 2. N + 1 3. N – 1 4. 5

37 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 92 82 94 80 77 100 85 90 98 97 75 100 Granby Units in $1,000’s

38 6.5 Trees 37


Download ppt "Trees Section 6.5 6.5 Trees 2 Trees Definition Examples Two Examples."

Similar presentations


Ads by Google