This preview shows pages 1–8. 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 Document
Unformatted text preview: Announcements:
MP 5 available. Due 10/31. 11:59p. (2 day extension)
Exam 2  11/2, 79p Today:
BTrees — Weiss 4.7 http://people.ksp.skl~kuko/bak/bigl Deﬁnition of a Btree Btree of order m is an mway tree For an internal node. # keys = #children 1
All leaves are on the same level All leaves hoId no more than m1 keys kg“
All nonroot internal nodes have between [ m12 ] and m i ren E, Root can be a leaf or have between 2 and m children.
Keys in a node are ordered. @9439»): ,  at!
Searching 3 Btree 8'7“ may (' b) boo]. BTREESEARCH(Btrev_Node 8 x, 1‘ key)( . ‘ in! 1  0; e “a
—.>vh1.1e (I1 < x.numkeya) 88 (key > x.key[1])lé“o’,o‘I L. ‘91! a) Li. [key  x.ke [11H 7
'—)xt (x.1 ® 1:
“else _)Bt reoNode  Analysis of BTrees (order m) The height of the Btree determines the number of disk seeks possible
in a search for data. We want to be able to say that the height the structure and thus the
number of disk seeks is no more than . 0
"up bl a if {#Otw " As we saw in the case of AVL trees. finding an upper bound on the
height (given n) is the same as ﬁnding a lower bound on the number
of nodes (given h). 0 We seek a relationship between the height of the structure (h) and the
amount of data it contains (n). Analysis of BTrees (order m) We seek a relationship between the height of the structure (h) and the
amount of date it contains (n).  The mmnumber of m in each level of a Btree of order m:
(For your convenience, let t = In], I .) L023 '
level 1 2
‘ iii: In nut level [1 2 kt"
 The Wﬂomw is the sum of these: + 22%} = l+ 105"" )
pa L":  So. the newm is:
'* 2 Wigi: :231 W Wm)“ Analysis of BTrees (order m) We seek a relationship between the height of the structure (h) and the
amount of data it contains (continued. . .)  So. the least total number of items is: a 29:  rewrite as an inequality about n. the total number of keys: ﬂ 7/ Dik ‘  rewrite that as an inequality about h. the height of the tree (note that
this bounds the number of disk seeks): 4 H 
1‘ ~ “igﬂvﬂ 000w Summary BTree search: . w, +9
O(m)time per node 0 ‘ﬂm‘ M‘ cow” “F . 0(Iogm n) height a up 9nd,, ‘23:. in em  mu (~ in o 0 Insert and Delete have similar stories.
W What you should know:
Motivation Deﬁnition ., as 9;“ Mt +.
Search algorithm and analysis _ u _ .
How one mi ht look on disk» [dd 0 ﬂat on a. Mf‘w" ‘, tl" “41% W‘
S “lam” W ¥* What you sh ot know:
Insert and Delete ...
View Full
Document
 Spring '09
 Heeren

Click to edit the document details