linear list representation ppt

algorithm to insert an element in linked list and applications of linked list data structure
Dr.DouglasPatton Profile Pic
Dr.DouglasPatton,United States,Teacher
Published Date:26-07-2017
Your Website URL(Optional)
Comment
Trees www.ThesisScientist.comComputer Scientist’s View root leaves branches nodes www.ThesisScientist.comLinear Lists And Trees • Linear lists are useful for serially ordered data.  (e , e , e , …, e ) 0 1 2 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. www.ThesisScientist.comHierarchical 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. www.ThesisScientist.comJava’s Classes (Part Of Figure 1.1) Object root children of root OutputStream Number Throwable FileOutputStream Integer Double Exception grand children of root RuntimeException www.ThesisScientist.com great grand child of rootDefinition • 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. www.ThesisScientist.comSubtrees Object root OutputStream Number Throwable FileOutputStream Integer Double Exception RuntimeException www.ThesisScientist.comLeaves Object OutputStream Number Throwable FileOutputStream Integer Double Exception RuntimeException www.ThesisScientist.comParent, Grandparent, Siblings, Ancestors, Descendants Object OutputStream Number Throwable FileOutputStream Integer Double Exception RuntimeException www.ThesisScientist.comLevels Object Level 1 Level 2 OutputStream Number Throwable FileOutputStream Integer Double Exception Level 3 RuntimeException www.ThesisScientist.com Level 4Caution • Some texts start level numbers at 0 rather than at 1. • Root is at level 0. • Its children are at level 1. • The grand children of the root are at level 2. • And so on. • We shall number levels with the root at level 1. www.ThesisScientist.comheight = depth = number of levels Object Level 1 Level 2 OutputStream Number Throwable FileOutputStream Integer Double Exception Level 3 RuntimeException www.ThesisScientist.com Level 4Node Degree = Number Of Children Object 3 OutputStream Number Throwable 2 1 1 0 0 1 0 FileOutputStream Integer Double Exception RuntimeException 0 www.ThesisScientist.comTree Degree = Max Node Degree Object 3 OutputStream Number Throwable 2 1 1 0 0 1 0 FileOutputStream Integer Double Exception RuntimeException 0 Degree of tree = 3. www.ThesisScientist.comBinary Tree • Finite (possibly empty) collection of elements. • A nonempty binary tree has a root element. • The remaining elements (if any) are partitioned into two binary trees. • These are called the left and right subtrees of the binary tree. www.ThesisScientist.comDifferences Between A Tree & A Binary Tree • No node in a binary tree may have a degree more than 2, whereas there is no limit on the degree of a node in a tree. • A binary tree may be empty; a tree cannot be empty. www.ThesisScientist.comDifferences Between A Tree & A Binary Tree • The subtrees of a binary tree are ordered; those of a tree are not ordered. a a b b • Are different when viewed as binary trees. • Are the same when viewed as trees. www.ThesisScientist.comArithmetic Expressions • (a + b) (c + d) + e – f/gh + 3.25 • Expressions comprise three kinds of entities.  Operators (+, -, /, ).  Operands (a, b, c, d, e, f, g, h, 3.25, (a + b), (c + d), etc.).  Delimiters ((, )). www.ThesisScientist.comOperator Degree • Number of operands that the operator requires. • Binary operator requires two operands.  a + b  c / d  e - f • Unary operator requires one operand.  + g  - h www.ThesisScientist.comInfix Form • Normal way to write an expression. • Binary operators come in between their left and right operands.  a b  a + b c  a b / c  (a + b) (c + d) + e – f/gh + 3.25 www.ThesisScientist.com

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.