#include "AvlTree.h" #include /** * Implements an unbalanced Avl search tree. * Note that all "matching" is based on the compares method. * @author Mark Allen Weiss */ /** * Construct the tree. */ template AvlTree::AvlTree( const Comparable & notFound ) : ITEM_NOT_FOUND( notFound ), root( NULL ) { } /** * Return the height of node t or -1 if NULL. */ template int AvlTree::height( AvlNode *t ) const { return t == NULL ? -1 : t->height; } /** * Return maximum of lhs and rhs. */ template int AvlTree::max( int lhs, int rhs ) const { return lhs > rhs ? lhs : rhs; }