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: MPSavaila Ie. Due 10/29. 11:59p. EC due 10/22.11/59p. .
Em). “ 2. 749 ramM “M; annex—s um).
Today: +0 agar; W Balanced BST— Weiss, 4.4 http://www.qmatica .com/DataStructures/Trees/BSThtmI Warmups:
1. Fill in the blanks to give the recursive deﬁnition of 8 BST:
A binary tree T is a binary search tree (BST) if:
 T is empty. or
oTis{;p.I‘_._T‘}and
x TL ) key(x) i key(r).
x E TR 9 key(x) 4 key(r).
and W
2. Correct the following speciﬁcation for ADT dictionary:
insert(ke data) traverseo > aﬁnd rerpove(&> void ’ du‘lk
3. T F BSTs have better worstcase performance than SLL J
4. How much would you pay for a BST ‘find' whose running time is 9(log n)? S, 'A’
N .
5. What data structure is used to support a level ordgr'daversa o a binary tree? ) $9 (ML something new... which tree makes you happiest? Hrz skorttfwa «oh .3
gym '32:,
\ e a» The “height balancebof a tree 1' is:
g = he_ight(T,)  heigbt(TR) A tree T is “height bala_gced" if: «"1": I NTt;T¢u&h (tiLO. \m ww 9mm ubmd’m m U: 0003.0 Binary Search Tree  is this tree “height balanced”? ea» 4“. m 4; u a W3 «.4. wangfvpﬁcuhm 0% Qoﬁ ovJw “was / a chm *H “14% “L
M, W (Xv/Nd”? WOLDMWSWQ’YIMZGJ stm M 4m Mam
balanced trees  rotations thither h” M mt balanced trees  rotations balanced trees  rotations balanced trees  rotations summary: 1. there are 4 kinds: left. right. leftright. rightleft (symmetric!)
local operations (subtrees not affected) 2.
3. constant time operations
4. BST characteristic maintained height balanced trees  we have a special name: Three issues to consider as we move toward implementation: Rotating
Maintaining height Detecting imbalance ...
View
Full Document
 Spring '09
 Heeren

Click to edit the document details