Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC-608 Database Systems

Similar presentations


Presentation on theme: "CPSC-608 Database Systems"— Presentation transcript:

1 CPSC-608 Database Systems
Fall 2018 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes #22 Notes #7

2 B+Trees Support fast search Support range search
Support dynamic changes Could be either dense or sparse dense: pointers to all records sparse: one pointer per block Notes #7

3 B+Trees A B+tree node of order n
where ph are pointers (disk addresses) and kh are search-keys (values of the attributes in the index) pn+1 kn k2 p2 k1 p1 p3 …… root 100 An Example B+ tree of order n=3 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

4 B+tree rules Rule 1. All leaves are at same lowest level (balanced tree) Rule 2. Pointers in leaves point to records except for “sequence pointer” Rule 3. Number of keys/pointers in nodes: Max. # pointers Max. # keys Min. # keys Non-leaf n+1 n (n+1)/2 (n+1)/2 1 Leaf (n+1)/2 + 1 (n+1)/2 Root 2 1 Notes #7

5 Search in a B+tree Start from the root Search in a leaf block
May not have to go to the data file Search(ptr, k); \\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Notes #7

6 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Notes #7

7 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

8 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Search(*prt, 130) root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

9 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Search(*prt, 130) root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

10 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Search(*prt, 130) root 100 100  130 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

11 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Search(*prt, 130) root 100 100  130 30 120 150 180 120  130 <150 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

12 Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1 A tree node
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Search(*prt, 130) root 100 100  130 30 120 150 180 120  130 <150 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 130 =130 return Notes #7

13 Range Search in B+tree To research all records whose key values are between k1 and k2: Notes #7

14 Range Search in B+tree To research all records whose key values are between k1 and k2: Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. Notes #7

15 Range Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Range Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

16 Range Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Range Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. Range-Search(*prt, 50, 125) root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

17 Range Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Range Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. Range-Search(*prt, 50, 125) Search(*prt, 50) root 100 30 120 150 180 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

18 Range Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Range Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. Range-Search(*prt, 50, 125) Search(*prt, 50) root 100 50 < 100 30 120 150 180 30  50 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 Notes #7

19 Range Search in B+tree Search(ptr, k); p1 k1 p2 k2 …… pn kn pn+1
\\ search a record of key value k in the subtree rooted at ptr \\ assume the B+tree is a dense index of order n Case 1. ptr is a leaf \\ pn+1 is the sequence pointer IF (k = ki) for a key ki in *ptr THEN return(pi); ELSE return(Null); Case 2. ptr is not a leaf find a key ki in *ptr such that ki-1 ≤ k < ki; return(Search(pi, k)); Range Search in B+tree p1 k1 p2 k2 …… pn kn pn+1 A tree node Range-Search(ptr, k1, k2) Call Search(ptr, k1); Follow the sequence pointers until the search key value is larger than k2. Range-Search(*prt, 50, 125) Search(*prt, 50) root 100 50 < 100 30 120 150 180 30  50 3 5 11 30 35 100 101 110 120 130 150 156 179 180 200 35 < 50 100  125 110  125 135 > 125 Not Return return return STOP 101  125 120  125 return return Notes #7

20 Insert into B+tree Notes #7

21 Insert into B+tree Basic idea:
Find the leaf L where the record r should be inserted; If L has further room, then insert r into L, and return; If L is full, spilt L plus r into two leaves (each is about half full): this causes an additional child for the parent P of L, thus we need to add a child to P; If P is already full, then we have to split P and add an additional child to P’s parent … (recursively) Notes #7

22 Insert into B+tree Simple case (space available for new child)
Leaf overflow Non-leaf overflow New root Notes #7

23 Insert into B+tree Simple case (space available for new child)
Leaf overflow Non-leaf overflow New root Notes #7

24 I. Simple case: Insert key 32
order n=3 100 30 40 3 5 11 30 31 Notes #7

25 I. Simple case: Insert key 32
order n=3 Insert(prt, 32) 100 30 40 3 5 11 30 31 Notes #7

26 I. Simple case: Insert key 32
order n=3 Insert(prt, 32) 100 32 < 100 30 40 30  32 <40 3 5 11 30 31 Notes #7

27 I. Simple case: Insert key 32
order n=3 Insert(prt, 32) 100 32 < 100 30 40 30  32 <40 3 5 11 30 31 room for 32 Notes #7

28 I. Simple case: Insert key 32
order n=3 Insert(prt, 32) 100 32 < 100 30 40 30  32 <40 3 5 11 30 31 32 Notes #7

29 Insert into B+tree Simple case (space available for new child)
Leaf overflow Non-leaf overflow New root Idea: when there is no space for a new child (all pointers are in use), split the node into two nodes, with both at least half full. Notes #7

30 Complication: node overflow
Notes #7

31 Complication: Leaf overflow
Notes #7

32 Complication: Leaf overflow
p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

33 Complication: Leaf overflow
p k k p’ p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

34 Complication: Leaf overflow
p k k p’ p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

35 Complication: Leaf overflow
p k k p’ q p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

36 Complication: Leaf overflow
p k k p’ ? q What is the key here? p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

37 Complication: Leaf overflow
p k k p’ ? q What is the key here? p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

38 Complication: Leaf overflow
p k k p’ q 𝑛+1 /2 +1 p1 k1 … p k p** p k … pn kn pn+1 kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 p k p’ p1 k1 … p k p k … … pn kn p* 𝑛+1 /2 𝑛+1 /2 𝑛+1 /2 +1 𝑛+1 /2 +1 pn+1 kn+1 Notes #7

39 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 11 30 31 Notes #7

40 Leaf overflow: Insert key 7 (order n = 3)
100 30 7 3 5 11 30 31 Notes #7

41 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 7 11 30 31 Notes #7

42 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 7 11 30 31 3 5 11 7 Notes #7

43 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 7 11 30 31 3 5 11 7 Notes #7

44 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 7 11 30 31 3 5 11 7 Notes #7

45 Leaf overflow: Insert key 7 (order n = 3)
100 30 3 5 7 11 30 31 3 5 11 7 Notes #7

46 Leaf overflow: Insert key 7 (order n = 3)
100 7 30 3 5 7 11 30 31 3 5 11 7 Notes #7

47 Complication: nonleaf overflow
Notes #7

48 Complication: nonleaf overflow
p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

49 Complication: nonleaf overflow
p k’ p’ k q (𝑛+1)/2 p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

50 Complication: nonleaf overflow
p k’ p’ k q (𝑛+1)/2 p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

51 Complication: nonleaf overflow
p k’ p’ k q (𝑛+1)/2 p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

52 Complication: nonleaf overflow
p k’ p’ k ? q (𝑛+1)/2 What is the key here? p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

53 Complication: nonleaf overflow
p k’ p’ k ? q (𝑛+1)/2 What is the key here? p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ not used kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

54 Complication: nonleaf overflow
p k’ p’ k k q (𝑛+1)/2 (𝑛+1)/2 p1 k1 p2 k2 … p k p p k … pn kn pn+1 kn+1 pn+2 (𝑛+1)/2 -1 (𝑛+1)/2 -1 (𝑛+1)/2 (𝑛+1)/2 +1 (𝑛+1)/2 +1 p k’ p’ kn+1 pn+2 p1 k1 … p k p k p k … pn kn pn+1 (𝑛+1)/2 (𝑛+1)/2 -1 (𝑛+1)/2 +1 (𝑛+1)/2 +1 Notes #7

55 Nonleaf overflow: Insert key 160 (order n = 3)
100 120 150 180 160 150 156 179 180 210 Notes #7

56 Nonleaf overflow: Insert key 160 (order n = 3)
100 120 150 180 150 156 160 179 180 210 150 156 179 160 Notes #7

57 Nonleaf overflow: Insert key 160 (order n = 3)
100 120 150 180 150 156 160 179 180 210 150 156 179 160 Notes #7

58 Nonleaf overflow: Insert key 160 (order n = 3)
100 120 150 180 160 150 156 160 179 180 210 150 156 179 160 Notes #7

59 Nonleaf overflow: Insert key 160 (order n = 3)
100 120 150 180 no room! 160 150 156 160 179 180 210 150 156 179 160 Notes #7

60 Nonleaf overflow: Insert key 160 (order n = 3)
120 150 180 160 100 120 150 180 160 150 156 160 179 180 210 150 156 179 160 Notes #7

61 Nonleaf overflow: Insert key 160 (order n = 3)
120 150 180 160 100 120 150 180 160 150 156 160 179 180 210 150 156 179 160 Notes #7

62 Nonleaf overflow: Insert key 160 (order n = 3)
120 150 180 160 100 160 120 150 180 160 150 156 160 179 180 210 150 156 179 160 Notes #7

63 Nonleaf overflow: Insert key 160 (order n = 3)
100 160 120 150 180 150 156 160 179 180 210 Notes #7

64 Insert into B+tree Simple case (space available for new child)
Leaf overflow Non-leaf overflow New root Notes #7

65 Insert into B+tree Simple case (space available for new child)
Leaf overflow Non-leaf overflow New root Notes #7

66 New root: Insert key 45 (order n = 3)
Notes #7

67 New root: Insert key 45 (order n = 3)
10 20 30 45 1 2 3 10 12 20 25 30 32 40 Notes #7

68 New root: Insert key 45 (order n = 3)
10 20 30 1 2 3 10 12 20 25 30 32 40 45 30 32 40 45 Notes #7

69 New root: Insert key 45 (order n = 3)
10 20 30 no room 1 2 3 10 12 20 25 30 32 40 45 30 32 40 45 Notes #7

70 New root: Insert key 45 (order n = 3)
10 20 30 10 20 40 40 30 1 2 3 10 12 20 25 30 32 40 45 30 32 40 45 Notes #7

71 New root: Insert key 45 (order n = 3)
30 10 20 30 10 20 40 40 1 2 3 10 12 20 25 30 32 40 45 30 32 40 45 Notes #7

72 New root: Insert key 45 (order n = 3)
30 10 20 40 1 2 3 10 12 20 25 30 32 40 45 Notes #7

73 Pseudo Code for Insertion in B+tree
Insert(pt, (p, k), (p', k')); \\ technically, the smallest key kmin in pt is also returned \\ (p, k) is a pointer-key pair to be inserted into the subtree rooted at pt; p' is a new sibling \\ of pt, if created, and k' is the smallest key value in p' ; Case 1. pt = (p1, k1, ..., pi, ki, --, pn+1) is a leaf \\ pn+1 is the sequence pointer IF (i < n) THEN insert (p, k) into pt; return(p' = Null, k' = 0); ELSE re-arrange (p1, k1), ..., (pn, kn), and (p, k) into (ρ1, κ1, ..., ρn+1, κn+1); create a new leaf p''; put (ρr+1, κr+1, …, ρn+1, κn+1, --, pn+1) in p''; \\ r = (n+1)/2 put (ρ1, κ1, ..., ρr, κr, --, p'') in pt; \\ pn+1 and p'' are sequence pointers in p'' and pt. IF pt is the root THEN create a new root with children pt and p'' (and key κr+1) ELSE return(p' = p'', k' = κr+1); Case 2. pt is not a leaf find a key ki in pt such that ki-1 ≤ k < ki; Insert(pi , (k, p), (k", p")); IF (p" = Null) THEN return(k' = 0, p' = Null); ELSE IF there is room in pt, THEN insert (k", p") into pt; return(k' = 0, p' = Null); ELSE re-arrange the content in pt and (k", p") into (ρ1, κ1, ..., ρn+1, κn+1, ρn+2); create a new node p''; put (ρr+1, κr+1, …, ρn+1, κn+1, ρn+2, -- ) in p''; \\ r = (n+1)/2 leave (ρ1, κ1, ..., ρr-1, κr-1, ρr , -- ) in pt; IF pt is the root THEN create a new root with children pt and p'' (and key κr) ELSE return(p' = p'', k' = κr ). Notes #7


Download ppt "CPSC-608 Database Systems"

Similar presentations


Ads by Google