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 DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE 4101/5101 Btrees 234 trees Prof. Andy Mirzaian Lists MovetoFront Search Trees Binary Search Trees MultiWay Search Trees Btrees Splay Trees 234 Trees RedBlack Trees SELF ADJUSTING WORSTCASE EFFICIENT competitive competitive? Linear Lists MultiLists Hash Tables DICTIONARIES 2 References: [CLRS] chapter 18 3 Btrees R. Bayer , E.M. McCreight, Organization and maintenance of large ordered indexes, Acta Informatica 1(3), 173189, 1972. Boeing Company B 4 Definition Btrees are a special class of multiway 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 Btree of order d if it satisfies the following properties: 1. Search property: T is a multiway 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 Btree 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: 234 tree = Btree 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 Btree 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 Btrees & 234 trees Btrees: 234 trees: This includes the level of external nodes....
View
Full
Document
 Winter '12
 Mirzaian
 Binary Search, Data Structures

Click to edit the document details