Title: AVL tree, B tree, and Graph
1AVL tree, B-tree, and Graph
COMP171 Fall 2007
2AVL tree
- Is this an AVL tree?
- Yes.
3AVL tree
Insert the value 4 into the AVL tree above,
doing any necessary rotations to maintain the
AVL property.
4AVL tree
5AVL tree
(ii)Then Insert the value 11 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
6AVL-tree
(iii)Then Insert the value 7 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
7AVL tree
(iv)Then Insert the value 8 into the AVL tree,
doing any necessary rotations to maintain the
AVL property.
8AVL-tree
(v)Then Insert the value 6 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
9AVL tree
(vi)Then Delete the value 11 from the AVL tree,
doing any necessary rotations to maintain the AVL
property.
10AVL tree
(vii)Then Delete the value 12 from the AVL tree,
doing any necessary rotations to maintain the
AVL property.
11Btree
12B-tree
69
72
78
83
66 67 68
69 70 71
13B-tree
69
72
78
83
72 73 74 75 76 77
66 67 68
69 70 71
14B-tree
69
72
78
83
75 76 77
66 67 68
69 70 71
75
72 73 74
75 76 77
15B-tree
75
69
72
78
83
72 73 74
75 76 77
78 79 81
66 67 68
69 70 71
16B-tree
41
66
75
87
69
72
78
83
72 73 74
75 76 77
78 79 81
66 67 68
69 70 71
17B-tree
42
66
75
87
48
51
54
42 44 46
18B-tree
42
66
75
87
48
51
54
42 44 46
51 52 53
54 56 58 59
48 49 50
19B-tree
42
66
75
87
48
52
54
54 56 58 59
42 44 46
52 53
48 49 50
20B-tree
42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54
48 49 50
21B-tree
42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54
48 49 50
22B-tree
42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54 56 59
48 49 50
23B-tree
42
66
75
87
48
52
42 44 46
52 53 54 56 59
48 49 50
24B-tree
42
66
75
87
48
8
18
26
35
35 36 37 38 39
42 44 46
48 49 50 52 53
25B-tree
35
66
75
87
42
48
8
18
26
35 36 37 38 39
42 44 46
48 49 50 52 53
26Btree
27B-tree
41
66
87
92
97
87 89 90
97 98 99
92 93 95
28B-tree
41
66
87
92
72
78
83
92 93 95 98 99
87 89 90
83 84 85
29B-tree
41
66
83
87
92
72
78
92 93 95 98 99
83 84 85
87 89 90
30B-tree
- Delete 14,16,24,31,32,38,39,35,36,37,26,28,30
41
66
83
8
18
26
35
48
51
54
35
18 20 22 24
26 28 30 31 32
8 10 12 14 16
35 36 37 38 39
31B-tree
- Delete 14,16,24,31,32,38,39,35,36,37,26,28,30
41
66
83
8
18
26
48
51
54
35
18 20 22 28 30
26 28 30 36 37
8 10 12
32B-tree
- Delete 14,16,24,31,32,38,39,35,36,37,26,28,30
41
66
83
8
18
48
51
54
35
18 20 22 28 30
8 10 12
33B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
83
87
92
72
78
92 93 95 98 99
83 84 85
87 89 90
34B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
83
89
93
72
78
93 95 98 99
83 84 85
89 90 92
35B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
83
90
95
72
78
95 98 99
83 84 85
90 92 93
36B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
83
95
72
78
95 98 99
83 84 85 92 93
37B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
72
78
83
95
83 84 85 92 93
95 98 99
38B-tree
- Delete 87,89,90,92,93,95,98,99,66,68,69,70,72,73,7
4,76,78,79,81,83,84,85
41
66
72
78
83
83 84 85 98 99
39Graph
- Consider the following adjacency-list for an
undirected graph G.
40Graph
- Draw the graph, clearly labeling all vertices.
41- Draw BFS tree from node 7
42Adjacent Matrix
43Graph
- Consider Graph Va, b, c, d, e, f, g, Eab,
ac, bd, cd, dg, df, show adjacent list and
topological sort. - Adjacent list
- a?b, c
- b?d
- c?d
- d?f, g
- f
- g
- Topological sort abcdgf