Download presentation
Presentation is loading. Please wait.
Published byGyörgy Subotić Modified over 6 years ago
1
MTree An implementation and An example with m=3
B C
2
Mtree (m=3) m = 3 a node contains at most 2 pieces of data
X A B C m = 3 a node contains at most 2 pieces of data an then branches 3 ways a node contains at least one piece of data and then branches 2 ways it is a 2-3 tree m = 4 a node contains at most 3 pieces of data an then branches 4 ways a node contains at least one piece of data and then branches 2 ways it is a 2-4 tree
3
Mtree (m=3) X A B C
4
X A B C
5
X A B C NOTE: we do not show parent link m is the maximum branching factor
6
Mtree (m=3) X A B C Another view
7
An example of an insertion leading to a split.
Split A X A B C An example of an insertion leading to a split. For m=3 there are 3 cases Only one is presented
8
Insertion resulting in overflow
Split A X A B C Insertion resulting in overflow
9
Split A X A B C Create a new node A’ X A A’ B C
10
Split A Create a new node A’ insert largest element in A into A’ X A B
11
Split A Create a new node A’ insert largest element in A into A’
X A B C Create a new node A’ insert largest element in A into A’ remove that element from A X A A’ B C
12
Add/Insert largest element in A into X
Split A X A B C Add/Insert largest element in A into X X A A’ B C
13
Add/Insert largest element in A into X
Split A X A B C Add/Insert largest element in A into X Remove that element from A X A A’ B C
14
Add/Insert largest element in A into X
Split A X A B C Add/Insert largest element in A into X Remove that element from A Update pointer to A’ X A A’ B C
15
Add/Insert largest element in A into X
Split A X A B C Add/Insert largest element in A into X Remove that element from A Update pointer to A’ Update pointer to A X A A’ B C
16
Split X X A B C X now splits X A A’ B C
17
Split X Another view X A A’ B C
18
We might also consider the cases when B splits when C splits m = 4
X A B C We might also consider the cases when B splits when C splits m = 4 m is large deletion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.