AVL tree, B tree, and Graph - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

AVL tree, B tree, and Graph

Description:

AVL tree. AVL tree ... AVL tree (iv)Then Insert the value 8 into the AVL tree, doing any necessary ... AVL tree (vii)Then Delete the value 12 from the AVL tree, ... – PowerPoint PPT presentation

Number of Views:726
Avg rating:3.0/5.0
Slides: 44
Provided by: tai6
Category:
Tags: avl | graph | tree

less

Transcript and Presenter's Notes

Title: AVL tree, B tree, and Graph


1
AVL tree, B-tree, and Graph
COMP171 Fall 2007
  • Lecture 27

2
AVL tree
  • Is this an AVL tree?
  • Yes.

3
AVL tree
Insert the value 4 into the AVL tree above,
doing any necessary rotations to maintain the
AVL property.
4
AVL tree
5
AVL tree
(ii)Then Insert the value 11 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
6
AVL-tree
(iii)Then Insert the value 7 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
7
AVL tree
(iv)Then Insert the value 8 into the AVL tree,
doing any necessary rotations to maintain the
AVL property.
8
AVL-tree
(v)Then Insert the value 6 into the AVL tree,
doing any necessary rotations to maintain the AVL
property.
9
AVL tree
(vi)Then Delete the value 11 from the AVL tree,
doing any necessary rotations to maintain the AVL
property.
10
AVL tree
(vii)Then Delete the value 12 from the AVL tree,
doing any necessary rotations to maintain the
AVL property.
11
Btree
12
B-tree
  • Insert 67 and 71

69
72
78
83
66 67 68
69 70 71
13
B-tree
  • Insert 77 and 75

69
72
78
83
72 73 74 75 76 77
66 67 68
69 70 71
14
B-tree
  • Insert 77 and 75

69
72
78
83
75 76 77
66 67 68
69 70 71
75
72 73 74
75 76 77
15
B-tree
  • Insert 77 and 75

75
69
72
78
83
72 73 74
75 76 77
78 79 81
66 67 68
69 70 71
16
B-tree
  • Insert 77 and 75

41
66
75
87
69
72
78
83
72 73 74
75 76 77
78 79 81
66 67 68
69 70 71
17
B-tree
  • Delete 41

42
66
75
87
48
51
54
42 44 46
18
B-tree
  • Delete 51

42
66
75
87
48
51
54
42 44 46
51 52 53
54 56 58 59
48 49 50
19
B-tree
  • Delete 51

42
66
75
87
48
52
54
54 56 58 59
42 44 46
52 53
48 49 50
20
B-tree
  • Delete 51

42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54
48 49 50
21
B-tree
  • Delete 58

42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54
48 49 50
22
B-tree
  • Delete 58

42
66
75
87
48
52
56
56 58 59
42 44 46
52 53 54 56 59
48 49 50
23
B-tree
  • Delete 59, 56, 54

42
66
75
87
48
52
42 44 46
52 53 54 56 59
48 49 50
24
B-tree
  • Delete 59, 56, 54

42
66
75
87
48
8
18
26
35
35 36 37 38 39
42 44 46
48 49 50 52 53
25
B-tree
  • Delete 59, 56, 54

35
66
75
87
42
48
8
18
26
35 36 37 38 39
42 44 46
48 49 50 52 53
26
Btree
27
B-tree
  • Delete 97

41
66
87
92
97
87 89 90
97 98 99
92 93 95
28
B-tree
  • Delete 97

41
66
87
92
72
78
83
92 93 95 98 99
87 89 90
83 84 85
29
B-tree
  • Delete 97

41
66
83
87
92
72
78
92 93 95 98 99
83 84 85
87 89 90
30
B-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
31
B-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
32
B-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
33
B-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
34
B-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
35
B-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
36
B-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
37
B-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
38
B-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
39
Graph
  • Consider the following adjacency-list for an
    undirected graph G.

40
Graph
  • Draw the graph, clearly labeling all vertices.

41
  • Draw BFS tree from node 7

42
Adjacent Matrix
43
Graph
  • 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
Write a Comment
User Comments (0)
About PowerShow.com