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: Today’s announcements: 0 MP4 available, EC due 3/4. due 3/11. 11:59p. /
Toda: , (JR—4 any334211 0
ﬂ 0 JO Binary t_r_ee, recursive deﬁnition: A binary tree I is either WM“; {3 An (important) example of a function on a binary tree: height(t)  length of longest path from root to a leaf Given a tree T. write a recursive defn of the height of T. height(T): 19 H,\m§= ' I mir‘fim’a m um = m ihz‘d‘m‘ﬁ‘w‘ﬁ *1 '3 Full Binary tree: a tree In which every node has 2 or 0 chlldren ===='
Full tree of height; F”: o E, is an empty tree ifh>1.thethi L.T .
MIL TINT: 0N 1L
mu. M W
m .
omL Mal I" nub! U I 9‘11“ Complete Binary tree: all leaves are at level height“) or height“) 1. an and all leaves at level height(t) are pushed to the iett. o “a
Po: k" '
Perfect tree of height h. P": p .
o P, is an empty tree 1 ' b . if h > 1, then P!) is {'13: LR}. P2:
whe TLandTRareP . R
a Complete tree of hei ht h. Ch: ﬂ, . an empty tree 3 0,
o if h > 1. then 6,, is {r. TL. TR}. and either: 0 f & E:Q._,_andms_ﬁ._t_ Check for understanding: I: every full tree complete?
is every complete tree full? Rooted. drected. cidered. binary trees ADT:
Insert 3 ”In Implementation: 4, root node loft and right
subtroo pointers Theorem: If that. m n data “an: In a binary ho. thm from m niL null pdnm. in. cunt and. loll and up\
mun yonnun. ...
View
Full Document
 Spring '09
 Heeren

Click to edit the document details