Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unions.

Similar presentations


Presentation on theme: "Unions."— Presentation transcript:

1 Unions

2 Which of the following are equivalence relations?
Equality Equivalent +/- error “has the same absolute value” The empty relation (nothing equivalent)

3 Which of the following are equivalence relations?
Equality (yes) Equivalent +/- error (no) “has the same absolute value” (yes) The empty relation (nothing equivalent) (no)

4 Unions by size create on set containing numbers between 1 and 10
What does find 1 return? 1 2 3 4 5 6 7 8 9 10

5 Unions by size How will the tree look after Join(2, 4)? 1 2 3 4 5 6 7
8 9 10

6 Unions by size How will the tree look after Join(2, 4)?
What about after Join(2, 6)? 2 1 3 4 5 6 7 8 9 10

7 Unions by size How will the tree look after Join(2, 6)?
What about after Join(2, 8)? 2 1 3 4 5 6 7 8 9 10

8 Unions by size Why aren’t find and union O(1)? 2 1 3 4 5 6 7 8 9 10

9 Unions by size What happens after Union(3, 2)? 3 2 1 4 5 6 7 8 9 10

10 Unions by size What happens after Union(3, 2)?
If we made all 2’s children point to 3, what would be the cost? 3 2 1 4 5 6 7 8 9 10

11 B-Trees Is the following a 3-5 B-Tree? If not, what would the correct tree be? (Assume leaves can have at most 3 keys) 7 8 9 11

12 B-Trees Not a 3-5 B-Tree Correction 7 8 9 11 8 9 11

13 B-Trees Is the following a 3-5 B-Tree? If not, what would be the correct tree? (Assume leaves can have at most 3 keys) 7 10 4 5 11 12 8 9

14 B-Trees What happens if we delete 11? 7 10 4 5 11 12 8 9

15 B-Trees What happens if we delete 11? 7 10 4 5 12 8 9

16 B-Trees What happens if we delete 11? 7 4 5 8 9 12


Download ppt "Unions."

Similar presentations


Ads by Google