# 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 pages 1–9. Sign up to view the full content.

INFSCI 0015 - Data Structures Lecture 26: Binary Search Trees Peter Brusilovsky http://www2.sis.pitt.edu/~peterb/0015-011/

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

View Full Document
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)
Terminology Node, branch, root, indegree, outdegree, leaf, parent, child, siblings, ancestor, descendent, path, level, height, depth, subtree

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

View Full Document
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
Binary trees Each node has <= 2 subtrees Recursive structure! Either empty or a root with two subtrees

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

View Full Document
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;

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

View Full Document
Height (for N nodes)
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
Ask a homework question - tutors are online