B-Tree Insert Algorithm (i=2) · 38 B-Tree Insert Algorithm (i=2) 1 2 1415 3?101319. 39 B-Tree...

Preview:

Citation preview

1

B-Tree Insert Algorithm (i=2)

10 13 19

7

2

B-Tree Insert Algorithm (i=2)

7 10 13 19

3

3

B-Tree Insert Algorithm (i=2)

7 10 13 19

3

?

4

B-Tree Insert Algorithm (i=2)

7 10

3

13 19

?

5

B-Tree Insert Algorithm (i=2)

3 7

3

13 19

?10

6

B-Tree Insert Algorithm (i=2)

3 7 13 19

?10

7

B-Tree Insert Algorithm (i=2)

3 7 13 19

?10

1

8

B-Tree Insert Algorithm (i=2)

3 7 13 19

?10

1

9

B-Tree Insert Algorithm (i=2)

3 7 13 19

?10

1

10

B-Tree Insert Algorithm (i=2)

1 3 7 13 19

?10

1

11

B-Tree Insert Algorithm (i=2)

1 3 7 13 19

?10

2

12

B-Tree Insert Algorithm (i=2)

1 3 7 13 19

?10

2

2

13

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?10

2

2

14

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?10

4

15

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?10

4

4

16

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?10

4

4

17

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?10

4

4

18

B-Tree Insert Algorithm (i=2)

1 2 3 7 13 19

?3 10

4

4

19

B-Tree Insert Algorithm (i=2)

1 2 13 19

?3 10

4 7

20

B-Tree Insert Algorithm (i=2)

1 2 13 19

?3 10

11

4 7

21

B-Tree Insert Algorithm (i=2)

1 2 11 13 19

?3 10

4 7

22

B-Tree Insert Algorithm (i=2)

1 2 11 13 19

?3 10

21

4 7

23

B-Tree Insert Algorithm (i=2)

1 2 11 13 19

?3 10

21

4 7

24

B-Tree Insert Algorithm (i=2)

1 2 11 13 19 21

?3 10

12

4 7

25

B-Tree Insert Algorithm (i=2)

1 2 11 13 19 21

?3 10

12

4 7 12

26

B-Tree Insert Algorithm (i=2)

1 2 11 13 19 21

?3 10

12

4 7 12

27

B-Tree Insert Algorithm (i=2)

1 2 11 13 19 21

?3 10

12

4 7 12

28

B-Tree Insert Algorithm (i=2)

1 2 11 13 19 21

?3 10 13

12

4 7 12

29

B-Tree Insert Algorithm (i=2)

1 2 11 19 21

?3 10 13

12

4 7 11 12

30

B-Tree Insert Algorithm (i=2)

1 2 19 21

?3 10 13

12

4 7 11 12

31

B-Tree Insert Algorithm (i=2)

1 2 19 21

?3 10 13

14

4 7 11 12

32

B-Tree Insert Algorithm (i=2)

1 2 14 19 21

?3 10 13

14

4 7 11 12

33

B-Tree Insert Algorithm (i=2)

1 2 14 19 21

?3 10 13

15

4 7 11 12

34

B-Tree Insert Algorithm (i=2)

1 2 14 15 19 21

?3 10 13

20

4 7 11 12

35

B-Tree Insert Algorithm (i=2)

1 2 14 15 19 21

?3 10 13

20

4 7 11 12

20

36

B-Tree Insert Algorithm (i=2)

1 2 14 15 19 21

?3 10 13

20

4 7 11 12

20

37

B-Tree Insert Algorithm (i=2)

1 2 14 15 19 21

?3 10 13 19

20

4 7 11 12

20

38

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

20

4 7 11 12

20 21

39

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

5

4 7 11 12

20 21

40

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

5

4 7 11 12

20 21

41

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

5

4 5 7 11 12

20 21

42

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

6

4 5 7 11 12

20 21

43

B-Tree Insert Algorithm (i=2)

1 2 14 15

?3 10 13 19

6

4 5 6 7 11 12

20 21

44

45

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

4 5 6 7 11 12

20 21

8

46

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

4 5 6 7 11 12

20 21

8

8

47

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

4 5 6 7 11 12

20 21

8

8

48

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

4 5 6 7 11 12

20 21

8

8

49

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

6 7 11 12

20 21

8

84 5

50

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

7 8 11 12

20 21

6

64 5

51

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

7 8 11 12

20 21

6

4 5

52

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

7 8 11 12

20 21

6

4 5

53

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

7 8 11 12

20 21

6

4 5

54

B-Tree Insert Algorithm (i=2)

1 2

14 15

?3 10 13 19

7 8 11 12

20 21

6

4 5

3 6

55

B-Tree Insert Algorithm (i=2)

1 2

14 15

?13 19

7 8 11 12

20 21

10

4 5

3 6

56

B-Tree Insert Algorithm (i=2)

1 2

14 15

?13 19

7 8 11 12

20 21

4 5

3 6

10

57

B-Tree Insert Algorithm (i=2)

1 2

14 15

?13 19

7 8 11 12

20 21

4 5

3 6

10

10

58

B-Tree Insert Algorithm (i=2)

1 2

14 15

?13 19

7 8 11 12

20 21

4 5

3 6

10 B-Tree with minimal occupacy

59

Delete Operations1. By stealing from other nodes2. By merging nodes3. By shriking

60

B-Tree Delete

1 2

14 15

?13 19

7 8 11 12

20 21

4 5

3 6

10

23

61

B-Tree Delete

1 2

14 15

?13 19

7 8 11 12

20 21 23

4 5

3 6

10

62

B-Tree Delete

1 2

14 15

?13 19

7 8 11 12

20 21 23

4 5

3 6

10

14

63

B-Tree Delete

1 2

14 15

?13 19

7 8 11 12

20 21 23

4 5

3 6

10

14

underflow

64

B-Tree Delete

1 2

15

?13 19

7 8 11 12

20 21 23

4 5

3 6

10

underflow

65

B-Tree Delete

1 2

15 19

?13 20

7 8 11 12

21 23

4 5

3 6

10

66

B-Tree Delete

1 2

15 19

?13 20

7 8 11 12

21 23

4 5

3 6

10

5

67

B-Tree Delete

1 2

15 19

?13 20

7 8 11 12

21 23

4 5

3 6

10

5

underflow

68

B-Tree Delete

1 2

15 19

?13 20

7 8 11 12

21 23

4

3 6

10

merge

69

B-Tree Delete

1 2

15 19

?13 20

7 8 11 12

21 23

4

3 6

10

merge

70

B-Tree Delete

1 2

15 19

?13 20

11 12

21 23

4 6 7 8

3

10underflow

71

B-Tree Delete

1 2

15 19

?13 20

11 12

21 23

4 6 7 8

3

10merge

72

B-Tree Delete

1 2

15 19

?13 20

11 12

21 23

4 6 7 8

3

10merge

73

B-Tree Delete

1 2

15 19

?

11 12

21 23

4 6 7 8

3 10 13 20

74

B-Tree Delete

1 2

15 19

?

11 12

21 23

4 6 7 8

3 10 13 20

Free nodesthat are nolonger used

Recommended