M-tree Algorithm2. Insert: Node N is leaf o10 o7 o2 Insert entry(ππ) into a leaf π, ππ1 π is a leaf IF π is not full Store entry(ππ)inπ Β o5 o11 o3 ππ Β o12 o8 o1 o6 o4 o9 3. Insert: Node N is leaf(con.) o10 o7 o2 o5 o11 o3 o12 o8 o1 o6 o4 ππ Β o9 Insert entry(ππ) into a leaf π, ππ1 π is a leaf IF π is full Split (π,πππ‘ππ¦(ππ)) Β 4. Insert: Node N is not leaf1 o10 o7 o2 Insert(π:node, entry(ππ):M-Tree entry) LetΒ π© be the set of entries in node π π=π1,π10 Let π©ππ= entries such thatΒ πππ,ππβ€πππ ππ1,ππ>π(ππ),ππ10,ππ>π(ππ) π©ππ={0} If π©ππ=0 Let entryππββπ©: πππβ,ππβπ(ππβ)is minimum Letπππβ=πππβ,ππ Insertβππ‘π(πππβ,,πππ‘ππ¦(ππ)) βππ‘π(πππβ, Β o5 o11 o3 o12 o8 o1 o6 o4 o9 ππ Β βππ‘π(πππβ, Β 5. o10 o10 o7 o7 o2 o2 Insert: Node N is not leaf o5 o5 o11 o11 o3 o3 o12 o12 o8 o8 o1 o1 o6 o6 o4 o4 o9 o9 ππ Β ππ Β 6. Split: N is not root (con.) o10 o7 o2 Split (NodeΒ πΒ ;entry(ππ)) Let π©=entries of node πβͺ Entry(ππ) π©={π1,π6,π12,ππ} Β π is not the root Let ππ be the parent ofπ,stored in ππ ππ is π1and ππ (parent pivot ofπ ) Allocate a new node πβ² Randomly choose two pivot objects ππ1,ππ2Β ππππΒ π©. Partition(π©,ππ1,ππ2)->π©1,π©2 π©1{π1,π12}&Β π©2{π6,ππ} Store π©1βs entries in π;π©2βs entries in πβ² π is not the current root Replace entry(ππ)with entry(ππ1)in ππ ππ is not full, store entry(ππ2)in ππ Β π Β o5 o11 o3 o12 π Β o1 o6 o4 o9 ππ Β πβ² Β πβ² Β 7. o10 o10 o7 o7 o2 o2 Split: N is not root o5 o5 o11 o11 o3 o3 o12 o12 π Β o1 o1 o6 o6 o4 o4 o9 o9 ππ Β ππ Β πβ² Β o12 πβ² Β π Β o6 o1 ππ Β 8. o10 o2 Split detail A(Update) Split (NodeΒ πΒ ;entry(ππ)) Let π©=entries of node πβͺ Entry(ππ) π©={π4,π3,π9,ππ} Β π is not the root Let ππ be the pivot object ofπ,stored in ππ ππ is π4 Allocate a new node πβ² Randomly choose two pivot objects ππ1,ππ2Β ππππΒ π©. ππ1=π4,ππ2=π9 Partition(π©,ππ1,ππ2)->π©1,π©2 π©1{ππ,π4}&Β π©2{π9,π3} Store π©1βs entries in π;π©2βs entries in πβ² π is not the current root Replace entry(ππ)with entry(ππ1)in ππ ππ is not full, store entry(ππ2)in ππ Β o7 o11 o12 o8 o3 Β π©2 Β o1 ππ Β o6 o4 o9 π©1 Β π Β πβ² Β 9. o7 o2 Split detail B(Update) Split (NodeΒ πΒ ;entry(ππ)) Let π©=entries of node πβͺ Entry(ππ) π©={π3,π4,π9,ππ} Β π is not the root Let ππ be the parent ofπ,stored in ππ ππ is π4(parent pivot ofπ ) Allocate a new node πβ² Randomly choose two pivot objects ππ1,ππ2Β ππππΒ π©. ππ1=ππ,ππ2=π9 Partition(π©,ππ1,ππ2)->π©1,π©2 π©1{ππ,π4}&Β π©2{π9,π3} Store π©1βs entries in π;π©2βs entries in πβ² π is not the current root Replace entry(ππ)with entry(ππ1)in ππ Node Β ππΒ is full. Split (ππ, entry(ππ2)) Β o10 o5 o6 Β π©2 Β o8 o3 ππ Β o4 π©1 Β o9 π Β 10. o7 o2 Split detail B(Update)(Con.) Split (NodeΒ πΒ ;entry(ππ)) Let π©=entries of node πβͺ Entry(ππ) π©={π2,π7,ππ,π9} Β π is the root Allocate a new node πβ² Randomly choose two pivot objects ππ1,ππ2Β ππππΒ π©. ππ1=ππ,ππ2=π2 Partition(π©,ππ1,ππ2)->π©1,π©2 π©1{ππ,π9}&Β π©2{π2,π7} Store π©1βs entries in π;π©2βs entries in πβ² π is the current root Allocate a new root node, ππ Store entry ππ1 and entry ππ2 in ππ Β π©2 Β o10 o5 o6 o8 o3 π©1 Β ππ Β o4 o9 π Β πβ² Β ππ Β