Tree - INFSCI 0015 Data Structures Lecture 26 Binary Search Trees Peter Brusilovsky http/www2.sis.pitt.edu/~peterb/0015-011 Trees in our life s s

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

View Full Document Right Arrow Icon
INFSCI 0015 - Data Structures Lecture 26: Binary Search Trees Peter Brusilovsky http://www2.sis.pitt.edu/~peterb/0015-011/
Background image of page 1

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

View Full DocumentRight Arrow Icon
Trees in our life Tree is an important data structure that represent a hierarchy Trees/hierarchies are very common in our life: Tree of species (is-a) Component tree (part-of) Family tree (parent-child)
Background image of page 2
Terminology Node, branch, root, indegree, outdegree, leaf, parent, child, siblings, ancestor, descendent, path, level, height, depth, subtree
Background image of page 3

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

View Full DocumentRight Arrow Icon
Decision Tree Binary tree associated with a decision process internal nodes: questions with yes/no answer external nodes: decisions Example: dining decision Want a fast meal? How about coffee? On expense account? Starbucks Spike’s Al Forno Café Paragon Yes No Yes No Yes No
Background image of page 4
Binary trees Each node has <= 2 subtrees Recursive structure! Either empty or a root with two subtrees
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Binary Trees: Implementation typedef   struct  node /* recursive definition */ {   int  data ;   struct  node *left ;   struct  node *right ; } TREE_NODE; typedef   struct  tree {   int  count ;   TREE_NODE *top ;  } TREE;
Background image of page 7

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

View Full DocumentRight Arrow Icon
Height (for N nodes)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/21/2010 for the course COMPUTER S 002 taught by Professor Ramtinkhosravi during the Spring '10 term at Amirkabir University of Technology.

Page1 / 30

Tree - INFSCI 0015 Data Structures Lecture 26 Binary Search Trees Peter Brusilovsky http/www2.sis.pitt.edu/~peterb/0015-011 Trees in our life s s

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

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