next up previous
Next: Up: Previous:

Splitting: B-Tree-Split-Child(x, i, y)

B-Tree-Split-Child(x, i, y) $\;\;\;\;\;$ $\;\;\;\;\;$; x is parent, y is child in ith subtree
$\;\;\;\;\;$Allocate(z) $\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$; n(z)=t-1, leaf(z) = leaf(y)
$\;\;\;\;\;$Copy y's second half keys and children to z
$\;\;\;\;\;$n(y) = t-1
$\;\;\;\;\;$Shift x's keys and children one to the right from i
$\;\;\;\;\;$childi+1(x) = z
$\;\;\;\;\;$keyi(x) = keyt(y)
$\;\;\;\;\;$n(x) = n(x) + 1
$\;\;\;\;\;$Write(x)
$\;\;\;\;\;$DiskWrite(y)
$\;\;\;\;\;$DiskWrite(z)

Running time is $\Theta(t)$ with 3 disk writes


next up previous
Next: Up: Previous: