19-binary-tree - CSE 143 Lecture 19 Binary Trees read 17.1...

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

View Full Document Right Arrow Icon
CSE 143 Lecture 19 Binary Trees read 17.1 - 17.2 slides created by Marty Stepp http://www.cs.washington.edu/143/
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Trees tree : A directed, acyclic structure of linked nodes. directed : Has one-way links between nodes. acyclic : No path wraps back around to the same node twice. binary tree : One where each node has at most two children. • A tree can be defined as either: – empty ( null ), or – a root node that contains: data , • a left subtree, and • a right subtree. – (The left and/or right subtree could be empty.) 7 6 3 2 1 5 4 root
Background image of page 2
3 Trees in computer science • folders/files on a computer • family genealogy; organizational charts • AI: decision trees • compilers: parse tree – a = (b + c) * d; • cell phone T9 d + * a = c b
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Terminology node : an object containing a data value and left/right children root : topmost node of a tree leaf : a node that has no children branch : any internal node; neither the root nor a leaf parent : a node that refers to this one child : a node that this node refers to sibling : a node with a common 7 6 3 2 1 5 4 root
Background image of page 4
5 Terminology 2 subtree : the tree of nodes reachable to the left/right from the current node height : length of the longest path from the root to any node level or depth : length of the path from a root to a given node full tree : one where every branch has 2 children 7 6 3 2 1 5 4 root height = 3 level 1 level 2 level 3
Background image of page 5

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

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

This note was uploaded on 10/30/2011 for the course COMPUTER S 143 taught by Professor John during the Spring '11 term at Washington State Community College.

Page1 / 18

19-binary-tree - CSE 143 Lecture 19 Binary Trees read 17.1...

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

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