Lecture 14

Learning objectives

After this class, you should be able to:

  1. Explain the following terms: tree, root, level, height, parent, child, ancestor, descendant, leaf, subtree, path, length of a path, binary tree, complete binary tree, and binary search tree.
  2. Derive bounds on the heights of different types of trees.
  3. Given a tree, show the order in which the vertices are visited with the following traversals: (i) preorder, (ii) postorder, (iii) inorder, and (iv) level-order.
  4. Given a tree, determine whether or not it is a binary search tree.
  5. Given a binary search tree, show the nodes visited while searching for an element.
  6. Derive the time complexity of searching a binary search tree.
  7. Write code to implement the four traversals mentioned above, and to search for an element in a binary search tree.

Reading assignment

  1. Sections 4.3 (up to page 129), 4.6.
  2. Lecture: Trees: Part 3 -- Binary search trees.
  3. Pages 129-130.

Exercises and review questions


Last modified: 29 Sep 2011