#ifndef CA_UWATERLOO_ALUMNI_DWHARDER_BINARY_TREE #define CA_UWATERLOO_ALUMNI_DWHARDER_BINARY_TREE // Author: Douglas Wilhelm Harder // Copyright (c) 2011 by Douglas Wilhelm Harder. All rights reserved. namespace Data_structures { template class Binary_tree { protected: Binary_node *root_node; public: Binary_tree(); virtual Binary_node *root() const; bool empty() const; int size() const; int height() const; }; template Binary_tree::Binary_tree(): root_node( 0 ) { // Empty constructor } template bool Binary_tree::empty() const { return ( root_node == 0 ); } template int Binary_tree::size() const { return ( root() == 0 ) ? 0 : root()->size(); } template int Binary_tree::height() const { return ( root() == 0 ) ? -1 : root()->height(); } } #endif