B - CSE 4101/5101 B-trees 2-3-4 trees Prof Andy Mirzaian...

This preview shows pages 1–11. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE 4101/5101 B-trees 2-3-4 trees Prof. Andy Mirzaian Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees 2-3-4 Trees Red-Black Trees SELF ADJUSTING WORST-CASE EFFICIENT competitive competitive? Linear Lists Multi-Lists Hash Tables DICTIONARIES 2 References: • [CLRS] chapter 18 3 B-trees R. Bayer , E.M. McCreight, “Organization and maintenance of large ordered indexes,” Acta Informatica 1(3), 173-189, 1972. Boeing Company B… 4 Definition § B-trees are a special class of multi-way search trees. § Node size: • d[x] = degree of node x, i.e., number of subtrees of x. • d[x] - 1 = number of keys stored in node x. (This is n[x] in [CLRS].) § Definition: Suppose d 2 is a fixed integer. T is a B-tree of order d if it satisfies the following properties: 1. Search property: T is a multi-way search tree. 2. Perfect balance: All external nodes of T have the same depth (h). 3. Node size range: d d[x] 2d nodes x root[T] 2 d[x] 2d for x = root[T]. 5 Example 36 12 18 26 42 48 2 4 6 8 10 14 16 20 22 24 28 30 32 34 38 40 44 46 50 52 54 h = 3 height, including external nodes A B-tree of order d = 3 with n = 27 keys. 6 Warning 2. Perfect Balance: All external nodes of T have the same depth. The only leaf in this tree [CLRS] says: All leaves have the same depth. 7 Applications External Memory Dictionary: § Large dictionaries stored in external memory. § Each node occupies a memory page. § Each node access triggers a slow page I/O. Keep height low. Make d large. § A memory page should hold the largest possible node (of degree 2d). Typical d is in the range 50 .. 2000 depending on page size. Internal Memory Dictionary: § 2-3-4 tree = B-tree of order 2. 8 h = Θ ( log d n) § Maximum n occurs when every node is full, i.e., has degree 2d: § Minimum n occurs when every node has degree d, except the root that has degree 2: § So, height grows logarithmic in n and inverse logarithmic in d: How small or large can a B-tree of order d and height h be? 9 ( 29 . 1 ) 2 ( ) 2 ( ) 2 ( ) 2 ( 1 ) 1 2 ( 1 2- = + ⋅ ⋅ ⋅ + + +- ≤- h h d d d d d n ). n (log ) 1 n ( log h d d 2 Ω = + ≥ ∴ ( 29 . 1 2 1 ) 1 ( 2 1 1 2 2- = + ⋅ ⋅ ⋅ + + +- + ≥-- h h d d d d d n ). n (log O log 1 h d d 2 1 n = + ≤ ∴ + ). n (log h d Θ = Height in B-trees & 2-3-4 trees B-trees: 2-3-4 trees: This includes the level of external nodes....
View Full Document

{[ snackBarMessage ]}

Page1 / 25

B - CSE 4101/5101 B-trees 2-3-4 trees Prof Andy Mirzaian...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online