Copyright © 2005 Suradet Jitprapaikulsarn
สงวนลิขสิทธิ์ 2548 สุรเดช จิตประไพกุลศาล

Homework 7 (Due 8 August 2005)

  1. Write a function, height, to determine the height of a binary tree.
  2. Write a function, maximum, to determine the maximum value in a binary tree of numbers.  Be careful about an empty tree.
  3. Write a function, BST?, to determine whether a binary tree is a binary search tree (BST).  A BST is a binary tree with the following properties:
  4. (Bonus) Write a function, longestDistance, to determine the longest distance between two nodes in a binary tree.  Note that the longest path does not need to include the root of the tree.