SUNY Geneseo Department of Computer Science


Introduction to Binary Trees

{Date}

CSci 141, Fall 2003
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture


Questions?

A Data Structure for Searching

Theta(n) search time for lists is really pretty bad

Can we devise a data structure that supports faster searches?

Consider how you would look something up in, e.g., a dictionary or telephone book

Generalize this...

Binary Tree

[A Binary Search Tree of Months]

Operations on (binary) trees - tree messages

Searching a binary search tree

  1. compare data you seek to root
  2. if data equals root, stop
  3. if data is less than root, repeat in left subtree
  4. if data greater than root, repeat in right subtree

Mini-assignment: phrase search w/ tree messages


Next Lecture