BTrees Mary Search Tree Maximum branching factor of
BTrees
M-ary Search Tree Maximum branching factor of M Complete tree has depth = log. M(N) Each internal node in a complete tree has M - 1 keys What is the expected runtime for lookup? 1. log. M(N) 2. M * log. M(N) 3. log 2(M) * log. M(N) 4. None of the above
B+ Trees are specialized M-ary search trees Each node has many keys ◦ subtree between two keys x and y contains values v such that x v < y ◦ binary search within a node to find correct subtree Each node takes one full {page, block, line} of memory x<3 3 x<7 3 7 12 21 7 x<12 12 x<21 21 x
B+ Tree Properties Result ◦ maximum branching factor of M ◦ tree is (log n) deep ◦ all operations run in (log n) ◦ other internal nodes have between M/2 and M children time ◦ operations pull in about M or L ◦ internal nodes contain only items at a time search keys (no data) ◦ each (non-root) leaf contains between L/2 and L keys ◦ all leaves are at the same depth
B-Tree Nodes Internal node ◦ i search keys; i+1 subtrees; M - i - 1 inactive entries k 1 k 2 1 2 … ki … __ i M - 1 Leaf ◦ j data keys; L - j inactive entries k 1 k 2 1 2 __ … kj j __ … __ L
Example B-Tree with M = 4 and L = 4 10 40 3 1 2 15 20 30 10 11 12 3 5 6 9 20 25 26 15 17 50 40 42 30 32 33 36 50 60 70
- Slides: 6