Lecture 18

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. Section 6.4, except 6.4.3. However, section 6.4.3 might give you some ideas for your homework, though you cannot directly use it.
  2. Page 242.

Exercises and review questions


Last modified: 3 Aug 2005