lec192 - Trees Nature Lover's View Of A Tree leaves...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Trees Nature Lover’s View Of A Tree root branches leaves Computer Scientist’s View branches leaves root nodes Linear Lists And Trees Linear lists are useful for serially ordered data. ƒ (e 0 , e 1 , e 2 , …, e n-1 ) ƒ Days of week. ƒ Months in a year. ƒ Students in this class. Trees are useful for hierarchically ordered data. ƒ Employees of a corporation. President, vice presidents, managers, and so on. ƒ Java’s classes. Object is at the top of the hierarchy. Subclasses of Object are next, and so on.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Hierarchical Data And Trees The element at the top of the hierarchy is the root . Elements next in the hierarchy are the children of the root. Elements next in the hierarchy are the grandchildren of the root, and so on. Elements that have no children are leaves . great grand child of root grand children of root children of root Java’s Classes (Part Of Figure 1.1) Object Number Throwable OutputStream Integer Double Exception FileOutputStream RuntimeException root Definition A tree t is a finite nonempty set of elements. One of these elements is called the root. The remaining elements, if any, are partitioned into trees, which are called the subtrees of t . Subtrees Object Number Throwable OutputStream Integer Double Exception FileOutputStream RuntimeException root
Background image of page 2
Leaves Object Number Throwable OutputStream Integer Double Exception FileOutputStream RuntimeException Parent, Grandparent, Siblings, Ancestors, Descendants Object Number Throwable OutputStream Integer Double Exception FileOutputStream RuntimeException Level 4 Level 3 Level 2 Levels Object Number Throwable OutputStream Integer Double Exception
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/18/2012 for the course COP 3530 taught by Professor Davis during the Fall '08 term at University of Florida.

Page1 / 10

lec192 - Trees Nature Lover's View Of A Tree leaves...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online